mirror of
https://github.com/samba-team/samba.git
synced 2025-08-29 13:49:30 +03:00
s3-ldb: update the old ldb in s3 to use new DLIST macros
(cherry picked from commit a7d8bfd373392eecf4fff33d39b85e1b55ad901d)
This commit is contained in:
committed by
Jeremy Allison
parent
ece7089918
commit
54fc99e04b
@ -45,15 +45,7 @@ static struct ltdb_wrap *tdb_list;
|
||||
static int ltdb_wrap_destructor(struct ltdb_wrap *w)
|
||||
{
|
||||
tdb_close(w->tdb);
|
||||
if (w->next) {
|
||||
w->next->prev = w->prev;
|
||||
}
|
||||
if (w->prev) {
|
||||
w->prev->next = w->next;
|
||||
}
|
||||
if (w == tdb_list) {
|
||||
tdb_list = w->next;
|
||||
}
|
||||
DLIST_REMOVE(tdb_list, w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -142,12 +134,7 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
|
||||
|
||||
talloc_set_destructor(w, ltdb_wrap_destructor);
|
||||
|
||||
w->next = tdb_list;
|
||||
w->prev = NULL;
|
||||
if (tdb_list) {
|
||||
tdb_list->prev = w;
|
||||
}
|
||||
tdb_list = w;
|
||||
DLIST_ADD(tdb_list, w);
|
||||
|
||||
return w->tdb;
|
||||
}
|
||||
|
@ -78,17 +78,7 @@ int store_destructor(struct results_store *store);
|
||||
|
||||
int store_destructor(struct results_store *store)
|
||||
{
|
||||
if (store->prev) {
|
||||
store->prev->next = store->next;
|
||||
}
|
||||
if (store->next) {
|
||||
store->next->prev = store->prev;
|
||||
}
|
||||
|
||||
if (store == store->priv->store) {
|
||||
store->priv->store = NULL;
|
||||
}
|
||||
|
||||
DLIST_REMOVE(store->priv->store, store);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -120,10 +110,7 @@ static struct results_store *new_store(struct private_data *priv)
|
||||
newr->controls = NULL;
|
||||
|
||||
/* put this entry as first */
|
||||
newr->prev = NULL;
|
||||
newr->next = priv->store;
|
||||
if (priv->store != NULL) priv->store->prev = newr;
|
||||
priv->store = newr;
|
||||
DLIST_ADD(priv->store, newr);
|
||||
|
||||
talloc_set_destructor(newr, store_destructor);
|
||||
|
||||
|
Reference in New Issue
Block a user