From b68ee108ca7aed9fd3fdfe5eefc1cf284a32fb17 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Thu, 2 Nov 2006 23:10:09 +0100 Subject: [PATCH] more useful list primitives Signed-off-by: Pierre Habouzit --- lib-lib/list.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib-lib/list.h b/lib-lib/list.h index 2d6e228..245a866 100644 --- a/lib-lib/list.h +++ b/lib-lib/list.h @@ -59,6 +59,19 @@ static inline LIST *mutt_add_list(LIST *head, const char *data) { *list = item; \ } \ \ + static inline type **prefix##_list_last(type **list) { \ + while (*list) { \ + list = &(*list)->next; \ + } \ + return list; \ + } \ + \ + static inline type **prefix##_list_append(type **list, type *item) { \ + list = prefix##_list_last(list); \ + *list = item; \ + return list; \ + } \ + \ static inline type **prefix##_list_init(type **list) { \ *list = NULL; \ return list; \ -- 2.20.1