From 9f7da6fea0bc9a330f8620d100e27d4eabbae253 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Aug 2006 01:52:24 +0000 Subject: r17579: make ldb build g++ friendly (This used to be commit 403cbd335594112e0c58fd68d20f0e3faad7d186) --- source4/lib/ldb/common/ldb_attributes.c | 18 ++++----- source4/lib/ldb/common/ldb_dn.c | 72 ++++++++++++++++----------------- source4/lib/ldb/include/ldb_private.h | 6 +-- source4/lib/ldb/modules/paged_results.c | 38 ++++++++--------- 4 files changed, 67 insertions(+), 67 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c index 13e721a266..c8a7909b4c 100644 --- a/source4/lib/ldb/common/ldb_attributes.c +++ b/source4/lib/ldb/common/ldb_attributes.c @@ -185,11 +185,11 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb) /* return the list of subclasses for a class */ -const char **ldb_subclass_list(struct ldb_context *ldb, const char *class) +const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname) { int i; for (i=0;ischema.num_classes;i++) { - if (ldb_attr_cmp(class, ldb->schema.classes[i].name) == 0) { + if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) { return (const char **)ldb->schema.classes[i].subclasses; } } @@ -200,7 +200,7 @@ const char **ldb_subclass_list(struct ldb_context *ldb, const char *class) /* add a new subclass */ -static int ldb_subclass_new(struct ldb_context *ldb, const char *class, const char *subclass) +static int ldb_subclass_new(struct ldb_context *ldb, const char *classname, const char *subclass) { struct ldb_subclass *s, *c; s = talloc_realloc(ldb, ldb->schema.classes, struct ldb_subclass, ldb->schema.num_classes+1); @@ -208,7 +208,7 @@ static int ldb_subclass_new(struct ldb_context *ldb, const char *class, const ch ldb->schema.classes = s; c = &s[ldb->schema.num_classes]; - c->name = talloc_strdup(s, class); + c->name = talloc_strdup(s, classname); if (c->name == NULL) goto failed; c->subclasses = talloc_array(s, char *, 2); @@ -229,19 +229,19 @@ failed: /* add a subclass */ -int ldb_subclass_add(struct ldb_context *ldb, const char *class, const char *subclass) +int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass) { int i, n; struct ldb_subclass *c; char **s; for (i=0;ischema.num_classes;i++) { - if (ldb_attr_cmp(class, ldb->schema.classes[i].name) == 0) { + if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) { break; } } if (i == ldb->schema.num_classes) { - return ldb_subclass_new(ldb, class, subclass); + return ldb_subclass_new(ldb, classname, subclass); } c = &ldb->schema.classes[i]; @@ -267,13 +267,13 @@ int ldb_subclass_add(struct ldb_context *ldb, const char *class, const char *sub /* remove a set of subclasses for a class */ -void ldb_subclass_remove(struct ldb_context *ldb, const char *class) +void ldb_subclass_remove(struct ldb_context *ldb, const char *classname) { int i; struct ldb_subclass *c; for (i=0;ischema.num_classes;i++) { - if (ldb_attr_cmp(class, ldb->schema.classes[i].name) == 0) { + if (ldb_attr_cmp(classname, ldb->schema.classes[i].name) == 0) { break; } } diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 064dc27a27..7dfcba0631 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -681,34 +681,34 @@ static struct ldb_dn_component ldb_dn_copy_component(void *mem_ctx, struct ldb_d */ struct ldb_dn *ldb_dn_copy_partial(void *mem_ctx, const struct ldb_dn *dn, int num_el) { - struct ldb_dn *new; + struct ldb_dn *newdn; int i, n, e; if (dn == NULL) return NULL; if (num_el <= 0) return NULL; - new = ldb_dn_new(mem_ctx); - LDB_DN_NULL_FAILED(new); + newdn = ldb_dn_new(mem_ctx); + LDB_DN_NULL_FAILED(newdn); - new->comp_num = num_el; - n = new->comp_num - 1; - new->components = talloc_array(new, struct ldb_dn_component, new->comp_num); + newdn->comp_num = num_el; + n = newdn->comp_num - 1; + newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num); - if (dn->comp_num == 0) return new; + if (dn->comp_num == 0) return newdn; e = dn->comp_num - 1; - for (i = 0; i < new->comp_num; i++) { - new->components[n - i] = ldb_dn_copy_component(new->components, + for (i = 0; i < newdn->comp_num; i++) { + newdn->components[n - i] = ldb_dn_copy_component(newdn->components, &(dn->components[e - i])); if ((e - i) == 0) { - return new; + return newdn; } } - return new; + return newdn; failed: - talloc_free(new); + talloc_free(newdn); return NULL; } @@ -755,32 +755,32 @@ struct ldb_dn *ldb_dn_build_child(void *mem_ctx, const char *attr, const char * value, const struct ldb_dn *base) { - struct ldb_dn *new; + struct ldb_dn *newdn; if (! ldb_valid_attr_name(attr)) return NULL; if (value == NULL || value == '\0') return NULL; if (base != NULL) { - new = ldb_dn_copy_partial(mem_ctx, base, base->comp_num + 1); - LDB_DN_NULL_FAILED(new); + newdn = ldb_dn_copy_partial(mem_ctx, base, base->comp_num + 1); + LDB_DN_NULL_FAILED(newdn); } else { - new = ldb_dn_new(mem_ctx); - LDB_DN_NULL_FAILED(new); + newdn = ldb_dn_new(mem_ctx); + LDB_DN_NULL_FAILED(newdn); - new->comp_num = 1; - new->components = talloc_array(new, struct ldb_dn_component, new->comp_num); + newdn->comp_num = 1; + newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num); } - new->components[0].name = talloc_strdup(new->components, attr); - LDB_DN_NULL_FAILED(new->components[0].name); + newdn->components[0].name = talloc_strdup(newdn->components, attr); + LDB_DN_NULL_FAILED(newdn->components[0].name); - new->components[0].value.data = (uint8_t *)talloc_strdup(new->components, value); - LDB_DN_NULL_FAILED(new->components[0].value.data); - new->components[0].value.length = strlen((char *)new->components[0].value.data); + newdn->components[0].value.data = (uint8_t *)talloc_strdup(newdn->components, value); + LDB_DN_NULL_FAILED(newdn->components[0].value.data); + newdn->components[0].value.length = strlen((char *)newdn->components[0].value.data); - return new; + return newdn; failed: - talloc_free(new); + talloc_free(newdn); return NULL; } @@ -797,37 +797,37 @@ struct ldb_dn *ldb_dn_make_child(void *mem_ctx, const struct ldb_dn_component *c struct ldb_dn *ldb_dn_compose(void *mem_ctx, const struct ldb_dn *dn1, const struct ldb_dn *dn2) { int i; - struct ldb_dn *new; + struct ldb_dn *newdn; if (dn2 == NULL && dn1 == NULL) { return NULL; } if (dn2 == NULL) { - new = ldb_dn_new(mem_ctx); - LDB_DN_NULL_FAILED(new); + newdn = ldb_dn_new(mem_ctx); + LDB_DN_NULL_FAILED(newdn); - new->comp_num = dn1->comp_num; - new->components = talloc_array(new, struct ldb_dn_component, new->comp_num); + newdn->comp_num = dn1->comp_num; + newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num); } else { int comp_num = dn2->comp_num; if (dn1 != NULL) comp_num += dn1->comp_num; - new = ldb_dn_copy_partial(mem_ctx, dn2, comp_num); + newdn = ldb_dn_copy_partial(mem_ctx, dn2, comp_num); } if (dn1 == NULL) { - return new; + return newdn; } for (i = 0; i < dn1->comp_num; i++) { - new->components[i] = ldb_dn_copy_component(new->components, + newdn->components[i] = ldb_dn_copy_component(newdn->components, &(dn1->components[i])); } - return new; + return newdn; failed: - talloc_free(new); + talloc_free(newdn); return NULL; } diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 99b9f99fb3..754e4bc859 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -191,9 +191,9 @@ int ldb_set_attrib_handler_syntax(struct ldb_context *ldb, const char *attr, const char *syntax); /* The following definitions come from lib/ldb/common/ldb_attributes.c */ -const char **ldb_subclass_list(struct ldb_context *ldb, const char *class); -void ldb_subclass_remove(struct ldb_context *ldb, const char *class); -int ldb_subclass_add(struct ldb_context *ldb, const char *class, const char *subclass); +const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname); +void ldb_subclass_remove(struct ldb_context *ldb, const char *classname); +int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass); int ldb_handler_copy(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out); diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index ddaed38fe9..52d26502ee 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -85,41 +85,41 @@ int store_destructor(struct results_store *store) static struct results_store *new_store(struct private_data *priv) { - struct results_store *new; + struct results_store *newr; int new_id = priv->next_free_id++; /* TODO: we should have a limit on the number of * outstanding paged searches */ - new = talloc(priv, struct results_store); - if (!new) return NULL; + newr = talloc(priv, struct results_store); + if (!newr) return NULL; - new->cookie = talloc_asprintf(new, "%d", new_id); - if (!new->cookie) { - talloc_free(new); + newr->cookie = talloc_asprintf(newr, "%d", new_id); + if (!newr->cookie) { + talloc_free(newr); return NULL; } - new->timestamp = time(NULL); + newr->timestamp = time(NULL); - new->num_sent = 0; /* To be removed */ - new->result = NULL; /* To be removed */ + newr->num_sent = 0; /* To be removed */ + newr->result = NULL; /* To be removed */ - new->first = NULL; - new->num_entries = 0; - new->first_ref = NULL; - new->controls = NULL; + newr->first = NULL; + newr->num_entries = 0; + newr->first_ref = NULL; + newr->controls = NULL; /* put this entry as first */ - new->prev = NULL; - new->next = priv->store; - if (priv->store != NULL) priv->store->prev = new; - priv->store = new; + newr->prev = NULL; + newr->next = priv->store; + if (priv->store != NULL) priv->store->prev = newr; + priv->store = newr; - talloc_set_destructor(new, store_destructor); + talloc_set_destructor(newr, store_destructor); - return new; + return newr; } struct paged_context { -- cgit