util: rewrite dlinklist.h so that DLIST_ADD_END() is O(1)
authorAndrew Tridgell <tridge@samba.org>
Wed, 10 Feb 2010 23:53:58 +0000 (15:53 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 10 Feb 2010 23:53:58 +0000 (15:53 -0800)
commit32809bd8c17c9c522338722177539aa3d60c4cbc
treeab1dd87ebbb38226b0a47f0e39eef15a58a24001
parent13ac4ad52187df7093904d4ad9c47d51bd1eda6f
util: rewrite dlinklist.h so that DLIST_ADD_END() is O(1)

This changes the meaning of the ->prev pointer in our doubly linked
lists to point at the end of the list from the front of the list. That
allows us to implement DLIST_ADD_END() and related functions in O(1)
time, which can be a huge saving in many places in Samba.

This also means that the 'type' argument to various DLIST_*() macros
is no longer needed, but I have left it in for now to keep the
patchset small, which will make it easier to revert if any problems
are found. In the future we should remove the 'type' arguments.

(jra. Move the one use of DLIST_TAIL over to the new macros).
lib/util/dlinklist.h
source3/lib/ldb/include/dlinklist.h
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/lib/ldb/include/dlinklist.h