summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 6ee8417e25..b9f3e79f20 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -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;
}