diff options
author | Jeremy Allison <jra@samba.org> | 2010-02-10 15:30:59 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-02-10 15:30:59 -0800 |
commit | 32575ed70f3210a2fe10edfd801ad1cb8f5caffa (patch) | |
tree | 421c9998f70b12d86c35bd1e2f54bd0c84019dcc /source4 | |
parent | f2d7d9774e3dafc643567605dd1eef908b6ded1a (diff) | |
download | samba-32575ed70f3210a2fe10edfd801ad1cb8f5caffa.tar.gz samba-32575ed70f3210a2fe10edfd801ad1cb8f5caffa.tar.bz2 samba-32575ed70f3210a2fe10edfd801ad1cb8f5caffa.zip |
Temporary changes to dlinklist to keep the implementation static whilst
uses of (list)->prev are moved over to DLIST_PREV. This will be replaced
when the final (new) version of the dlinklist.h header is added.
Jeremy.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/include/dlinklist.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/ldb/include/dlinklist.h b/source4/lib/ldb/include/dlinklist.h index 62f885dd30..0bd80a79df 100644 --- a/source4/lib/ldb/include/dlinklist.h +++ b/source4/lib/ldb/include/dlinklist.h @@ -51,6 +51,22 @@ do { \ if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \ } while (0) +#define DLIST_HEAD(p, result_head) \ +do { \ + (result_head) = (p); \ + while (DLIST_PREV(result_head)) (result_head) = (result_head)->prev; \ +} while(0) + +/* return the last element in the list */ +#define DLIST_TAIL(list, result_tail) \ +do { \ + (result_tail) = (list); \ + while ((result_tail) && (result_tail)->next) (result_tail) = (result_tail)->next; \ +} while (0); + +/* return the previous element in the list. */ +#define DLIST_PREV(p) ((p)?(p)->prev:NULL) + /* promote an element to the top of the list */ #define DLIST_PROMOTE(list, p) \ do { \ |