*/
#include "ldb_tdb.h"
+#include "dlinklist.h"
/*
the purpose of this code is to work around the braindead posix locking
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;
}
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;
}