1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

s4-ldb: update ldb_tdb to use new DLIST_ macros

(cherry picked from commit 6ede911654566a7e21ded70dacac68df3b6a1bca)
This commit is contained in:
Andrew Tridgell 2010-02-06 12:37:48 +11:00 committed by Jeremy Allison
parent f017edc59f
commit a5d2fb752c

View File

@ -22,6 +22,7 @@
*/
#include "ldb_tdb.h"
#include "dlinklist.h"
/*
the purpose of this code is to work around the braindead posix locking
@ -42,15 +43,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;
}
@ -143,12 +136,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;
}