X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftlist%2Ftlist.h;h=28978514678d99a7df24ca66872465cf0cea3586;hp=937a834c0184fb4d54928ca57db9668a929b1f8c;hb=d81e79b8dfdfb0da8766c022e767a5b040e5d07b;hpb=c23a40c7f1ac9fad0146b46988a41f196aae933f diff --git a/ccan/tlist/tlist.h b/ccan/tlist/tlist.h index 937a834c..28978514 100644 --- a/ccan/tlist/tlist.h +++ b/ccan/tlist/tlist.h @@ -213,6 +213,30 @@ (char *)(&(h)->_tcon[0].canary->member) - \ (char *)((h)->_tcon[0].canary))) +/** + * tlist_next - get the next entry in a list + * @h: the tlist + * @n: the list element + * @member: the list_node member of the type + * + * Returns the element of list @h immediately after @n, or NULL, if @n + * is the last element in the list. + */ +#define tlist_next(h, n, member) \ + list_next(tlist_raw((h), (n)), (n), member) + +/** + * tlist_prev - get the previous entry in a list + * @h: the tlist + * @n: the list element + * @member: the list_node member of the type + * + * Returns the element of list @h immediately before @n, or NULL, if + * @n is the first element in the list. + */ +#define tlist_prev(h, n, member) \ + list_prev(tlist_raw((h), (n)), (n), member) + /** * tlist_for_each - iterate through a list. * @h: the tlist