From 9c1cbbdb229978f6a6686ae31cbb401174fd7e93 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 4 Oct 2011 09:59:47 +0200 Subject: src/llist.h: Add LLIST_{,TS}_FIND_FOREACH_CONT In contrast to LLIST_{,TS}_FIND_FOREACH, these convenience macros search for the first match and return successors until there is an item that isn't matched by the filter callback. Any items beyond the first cut-off are discarded. Should be used when results are known to be continuous, such as appointments and events belonging to a specific day etc. Signed-off-by: Lukas Fleischer --- src/llist_ts.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/llist_ts.h') diff --git a/src/llist_ts.h b/src/llist_ts.h index e152f5d..0822a3d 100644 --- a/src/llist_ts.h +++ b/src/llist_ts.h @@ -78,6 +78,9 @@ struct llist_ts { #define LLIST_TS_FIND_FOREACH(l_ts, data, fn_match, i) \ for (i = LLIST_TS_FIND_FIRST (l_ts, data, fn_match); i; \ i = LLIST_TS_FIND_NEXT (i, data, fn_match)) +#define LLIST_TS_FIND_FOREACH_CONT(l_ts, data, fn_match, i) \ + for (i = LLIST_TS_FIND_FIRST (l_ts, data, fn_match); i; \ + i = LLIST_TS_NEXT_FILTER (i, data, fn_match)) /* Accessing list item data. */ #define LLIST_TS_GET_DATA(i) llist_get_data (i) -- cgit v1.2.3-54-g00ecf