summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-01-12 16:00:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:47 -0500
commita2f77f979d7271a9708ed06f43b00ffb10ec7f4c (patch)
treef9de8a02597f95ba9c7af1c2086a69cafacb3a87 /source4/lib/ldb/ldb_tdb
parent7588b41e153ebd84c974f7289847bcd05f32ba4b (diff)
downloadsamba-a2f77f979d7271a9708ed06f43b00ffb10ec7f4c.tar.gz
samba-a2f77f979d7271a9708ed06f43b00ffb10ec7f4c.tar.bz2
samba-a2f77f979d7271a9708ed06f43b00ffb10ec7f4c.zip
r4714: move the ldb code to the new talloc interface (eg remove _p suffix)
this helps standalone building of ldb renew the schema module split code into functions to improve readability and code reuse add and modify works correctly but we need a proper testsuite Simo (This used to be commit a681ae365ff1b5a2771b42ebd90336651ce1e513)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c20
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c32
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_pack.c6
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c16
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c20
5 files changed, 47 insertions, 47 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index ebdfdb7bed..8cc6616d52 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -54,7 +54,7 @@ static int ltdb_baseinfo_init(struct ldb_module *module)
ltdb->sequence_number = atof(initial_sequence_number);
- msg = talloc_p(ltdb, struct ldb_message);
+ msg = talloc(ltdb, struct ldb_message);
if (msg == NULL) {
goto failed;
}
@@ -120,11 +120,11 @@ int ltdb_cache_load(struct ldb_module *module)
double seq;
if (ltdb->cache == NULL) {
- ltdb->cache = talloc_zero_p(ltdb, struct ltdb_cache);
+ ltdb->cache = talloc_zero(ltdb, struct ltdb_cache);
if (ltdb->cache == NULL) goto failed;
- ltdb->cache->indexlist = talloc_zero_p(ltdb->cache, struct ldb_message);
- ltdb->cache->subclasses = talloc_zero_p(ltdb->cache, struct ldb_message);
- ltdb->cache->attributes = talloc_zero_p(ltdb->cache, struct ldb_message);
+ ltdb->cache->indexlist = talloc_zero(ltdb->cache, struct ldb_message);
+ ltdb->cache->subclasses = talloc_zero(ltdb->cache, struct ldb_message);
+ ltdb->cache->attributes = talloc_zero(ltdb->cache, struct ldb_message);
if (ltdb->cache->indexlist == NULL ||
ltdb->cache->subclasses == NULL ||
ltdb->cache->attributes == NULL) {
@@ -133,7 +133,7 @@ int ltdb_cache_load(struct ldb_module *module)
}
talloc_free(ltdb->cache->baseinfo);
- ltdb->cache->baseinfo = talloc_p(ltdb->cache, struct ldb_message);
+ ltdb->cache->baseinfo = talloc(ltdb->cache, struct ldb_message);
if (ltdb->cache->baseinfo == NULL) goto failed;
if (ltdb_search_dn1(module, LTDB_BASEINFO, ltdb->cache->baseinfo) == -1) {
@@ -165,9 +165,9 @@ int ltdb_cache_load(struct ldb_module *module)
talloc_free(ltdb->cache->subclasses);
talloc_free(ltdb->cache->attributes);
- ltdb->cache->indexlist = talloc_zero_p(ltdb->cache, struct ldb_message);
- ltdb->cache->subclasses = talloc_zero_p(ltdb->cache, struct ldb_message);
- ltdb->cache->attributes = talloc_zero_p(ltdb->cache, struct ldb_message);
+ ltdb->cache->indexlist = talloc_zero(ltdb->cache, struct ldb_message);
+ ltdb->cache->subclasses = talloc_zero(ltdb->cache, struct ldb_message);
+ ltdb->cache->attributes = talloc_zero(ltdb->cache, struct ldb_message);
if (ltdb->cache->indexlist == NULL ||
ltdb->cache->subclasses == NULL ||
ltdb->cache->attributes == NULL) {
@@ -204,7 +204,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module)
char *s = NULL;
int ret;
- msg = talloc_p(ltdb, struct ldb_message);
+ msg = talloc(ltdb, struct ldb_message);
if (msg == NULL) {
errno = ENOMEM;
return -1;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index 88ef997a03..af325f9203 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -180,7 +180,7 @@ static int ltdb_index_dn_simple(struct ldb_module *module,
dn = ldb_dn_key(ldb, tree->u.simple.attr, &tree->u.simple.value);
if (!dn) return -1;
- msg = talloc_p(list, struct ldb_message);
+ msg = talloc(list, struct ldb_message);
if (msg == NULL) {
return -1;
}
@@ -200,7 +200,7 @@ static int ltdb_index_dn_simple(struct ldb_module *module,
el = &msg->elements[i];
- list->dn = talloc_array_p(list, char *, el->num_values);
+ list->dn = talloc_array(list, char *, el->num_values);
if (!list->dn) {
break;
}
@@ -259,7 +259,7 @@ static int ltdb_index_dn_objectclass(struct ldb_module *module,
return -1;
}
tree2.u.simple.value = el->values[j];
- list2 = talloc_p(list, struct dn_list);
+ list2 = talloc(list, struct dn_list);
if (list2 == NULL) {
return -1;
}
@@ -313,12 +313,12 @@ static int list_intersect(struct ldb_context *ldb,
return 0;
}
- list3 = talloc_p(ldb, struct dn_list);
+ list3 = talloc(ldb, struct dn_list);
if (list3 == NULL) {
return -1;
}
- list3->dn = talloc_array_p(list3, char *, list->count);
+ list3->dn = talloc_array(list3, char *, list->count);
if (!list3->dn) {
talloc_free(list);
talloc_free(list3);
@@ -363,7 +363,7 @@ static int list_union(struct ldb_context *ldb,
return 0;
}
- d = talloc_realloc_p(list, list->dn, char *, list->count + list2->count);
+ d = talloc_realloc(list, list->dn, char *, list->count + list2->count);
if (!d) {
talloc_free(list);
return -1;
@@ -415,7 +415,7 @@ static int ltdb_index_dn_or(struct ldb_module *module,
struct dn_list *list2;
int v;
- list2 = talloc_p(module, struct dn_list);
+ list2 = talloc(module, struct dn_list);
if (list2 == NULL) {
return -1;
}
@@ -500,7 +500,7 @@ static int ltdb_index_dn_and(struct ldb_module *module,
struct dn_list *list2;
int v;
- list2 = talloc_p(module, struct dn_list);
+ list2 = talloc(module, struct dn_list);
if (list2 == NULL) {
return -1;
}
@@ -591,7 +591,7 @@ static int ldb_index_filter(struct ldb_module *module, struct ldb_parse_tree *tr
struct ldb_message *msg;
int ret;
- msg = talloc_p(module, struct ldb_message);
+ msg = talloc(module, struct ldb_message);
if (msg == NULL) {
return -1;
}
@@ -642,7 +642,7 @@ int ltdb_search_indexed(struct ldb_module *module,
return -1;
}
- dn_list = talloc_p(module, struct dn_list);
+ dn_list = talloc(module, struct dn_list);
if (dn_list == NULL) {
return -1;
}
@@ -672,7 +672,7 @@ static int ltdb_index_add1_new(struct ldb_context *ldb,
struct ldb_message_element *el2;
/* add another entry */
- el2 = talloc_realloc_p(msg, msg->elements,
+ el2 = talloc_realloc(msg, msg->elements,
struct ldb_message_element, msg->num_elements+1);
if (!el2) {
return -1;
@@ -684,7 +684,7 @@ static int ltdb_index_add1_new(struct ldb_context *ldb,
return -1;
}
msg->elements[msg->num_elements].num_values = 0;
- msg->elements[msg->num_elements].values = talloc_p(msg->elements, struct ldb_val);
+ msg->elements[msg->num_elements].values = talloc(msg->elements, struct ldb_val);
if (!msg->elements[msg->num_elements].values) {
return -1;
}
@@ -717,7 +717,7 @@ static int ltdb_index_add1_add(struct ldb_context *ldb,
}
}
- v2 = talloc_realloc_p(msg->elements, msg->elements[idx].values,
+ v2 = talloc_realloc(msg->elements, msg->elements[idx].values,
struct ldb_val,
msg->elements[idx].num_values+1);
if (!v2) {
@@ -749,7 +749,7 @@ static int ltdb_index_add1(struct ldb_module *module, char *dn,
return -1;
}
- msg = talloc_p(dn_key, struct ldb_message);
+ msg = talloc(dn_key, struct ldb_message);
if (msg == NULL) {
return -1;
}
@@ -842,7 +842,7 @@ int ltdb_index_del_value(struct ldb_module *module, const char *dn,
return -1;
}
- msg = talloc_p(dn_key, struct ldb_message);
+ msg = talloc(dn_key, struct ldb_message);
if (msg == NULL) {
talloc_free(dn_key);
return -1;
@@ -948,7 +948,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
return 0;
}
- msg = talloc_p(module, struct ldb_message);
+ msg = talloc(module, struct ldb_message);
if (msg == NULL) {
return -1;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index 501728fac5..4433e16cb2 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -99,7 +99,7 @@ int ltdb_pack_data(struct ldb_module *module,
}
/* allocate it */
- data->dptr = talloc_array_p(ldb, char, size);
+ data->dptr = talloc_array(ldb, char, size);
if (!data->dptr) {
errno = ENOMEM;
return -1;
@@ -199,7 +199,7 @@ int ltdb_unpack_data(struct ldb_module *module,
goto failed;
}
- message->elements = talloc_array_p(message, struct ldb_message_element, message->num_elements);
+ message->elements = talloc_array(message, struct ldb_message_element, message->num_elements);
if (!message->elements) {
errno = ENOMEM;
goto failed;
@@ -225,7 +225,7 @@ int ltdb_unpack_data(struct ldb_module *module,
message->elements[i].num_values = pull_uint32(p, 0);
message->elements[i].values = NULL;
if (message->elements[i].num_values != 0) {
- message->elements[i].values = talloc_array_p(message->elements,
+ message->elements[i].values = talloc_array(message->elements,
struct ldb_val,
message->elements[i].num_values);
if (!message->elements[i].values) {
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 295c9578cc..536d1ac005 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -47,7 +47,7 @@ static int msg_add_element(struct ldb_context *ldb,
unsigned int i;
struct ldb_message_element *e2, *elnew;
- e2 = talloc_realloc_p(ret, ret->elements, struct ldb_message_element, ret->num_elements+1);
+ e2 = talloc_realloc(ret, ret->elements, struct ldb_message_element, ret->num_elements+1);
if (!e2) {
return -1;
}
@@ -61,7 +61,7 @@ static int msg_add_element(struct ldb_context *ldb,
}
if (el->num_values) {
- elnew->values = talloc_array_p(ret->elements, struct ldb_val, el->num_values);
+ elnew->values = talloc_array(ret->elements, struct ldb_val, el->num_values);
if (!elnew->values) {
return -1;
}
@@ -117,7 +117,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module,
struct ldb_message *ret;
int i;
- ret = talloc_p(ldb, struct ldb_message);
+ ret = talloc(ldb, struct ldb_message);
if (!ret) {
return NULL;
}
@@ -279,12 +279,12 @@ int ltdb_search_dn(struct ldb_module *module, char *dn,
int ret;
struct ldb_message *msg, *msg2;
- *res = talloc_array_p(ldb, struct ldb_message *, 2);
+ *res = talloc_array(ldb, struct ldb_message *, 2);
if (! *res) {
return -1;
}
- msg = talloc_p(*res, struct ldb_message);
+ msg = talloc(*res, struct ldb_message);
if (msg == NULL) {
talloc_free(*res);
*res = NULL;
@@ -333,7 +333,7 @@ int ltdb_add_attr_results(struct ldb_module *module, struct ldb_message *msg,
}
/* add to the results list */
- res2 = talloc_realloc_p(ldb, *res, struct ldb_message *, (*count)+2);
+ res2 = talloc_realloc(ldb, *res, struct ldb_message *, (*count)+2);
if (!res2) {
talloc_free(msg2);
return -1;
@@ -378,7 +378,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
return 0;
}
- msg = talloc_p(sinfo, struct ldb_message);
+ msg = talloc(sinfo, struct ldb_message);
if (msg == NULL) {
return -1;
}
@@ -442,7 +442,7 @@ static int ltdb_search_full(struct ldb_module *module,
int ret, count;
struct ltdb_search_info *sinfo;
- sinfo = talloc_p(ltdb, struct ltdb_search_info);
+ sinfo = talloc(ltdb, struct ltdb_search_info);
if (sinfo == NULL) {
return -1;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 288633cb01..b1de96986d 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -300,7 +300,7 @@ static int ltdb_delete(struct ldb_module *module, const char *dn)
goto failed;
}
- msg = talloc_p(module, struct ldb_message);
+ msg = talloc(module, struct ldb_message);
if (msg == NULL) {
goto failed;
}
@@ -368,7 +368,7 @@ static int msg_add_element(struct ldb_context *ldb,
struct ldb_message_element *e2;
unsigned int i;
- e2 = talloc_realloc_p(msg, msg->elements, struct ldb_message_element,
+ e2 = talloc_realloc(msg, msg->elements, struct ldb_message_element,
msg->num_elements+1);
if (!e2) {
errno = ENOMEM;
@@ -383,7 +383,7 @@ static int msg_add_element(struct ldb_context *ldb,
e2->flags = el->flags;
e2->values = NULL;
if (el->num_values != 0) {
- e2->values = talloc_array_p(msg->elements, struct ldb_val, el->num_values);
+ e2->values = talloc_array(msg->elements, struct ldb_val, el->num_values);
if (!e2->values) {
errno = ENOMEM;
return -1;
@@ -422,7 +422,7 @@ static int msg_delete_attribute(struct ldb_module *module,
}
msg->num_elements--;
i--;
- msg->elements = talloc_realloc_p(msg, msg->elements,
+ msg->elements = talloc_realloc(msg, msg->elements,
struct ldb_message_element,
msg->num_elements);
}
@@ -498,7 +498,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
return -1;
}
- msg2 = talloc_p(tdb_key.dptr, struct ldb_message);
+ msg2 = talloc(tdb_key.dptr, struct ldb_message);
if (msg2 == NULL) {
talloc_free(tdb_key.dptr);
return -1;
@@ -547,7 +547,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
}
}
- vals = talloc_realloc_p(msg2->elements, el2->values, struct ldb_val,
+ vals = talloc_realloc(msg2->elements, el2->values, struct ldb_val,
el2->num_values + el->num_values);
if (vals == NULL)
@@ -661,7 +661,7 @@ static int ltdb_rename(struct ldb_module *module, const char *olddn, const char
return -1;
}
- msg = talloc_p(module, struct ldb_message);
+ msg = talloc(module, struct ldb_message);
if (msg == NULL) {
goto failed;
}
@@ -765,7 +765,7 @@ struct ldb_context *ltdb_connect(const char *url,
TDB_CONTEXT *tdb;
struct ldb_context *ldb;
- ldb = talloc_zero_p(NULL, struct ldb_context);
+ ldb = talloc_zero(NULL, struct ldb_context);
if (!ldb) {
errno = ENOMEM;
return NULL;
@@ -798,7 +798,7 @@ struct ldb_context *ltdb_connect(const char *url,
return NULL;
}
- ltdb = talloc_zero_p(ldb, struct ltdb_private);
+ ltdb = talloc_zero(ldb, struct ltdb_private);
if (!ltdb) {
tdb_close(tdb);
talloc_free(ldb);
@@ -811,7 +811,7 @@ struct ldb_context *ltdb_connect(const char *url,
talloc_set_destructor(ltdb, ltdb_destructor);
- ldb->modules = talloc_p(ldb, struct ldb_module);
+ ldb->modules = talloc(ldb, struct ldb_module);
if (!ldb->modules) {
talloc_free(ldb);
errno = ENOMEM;