summaryrefslogtreecommitdiff
path: root/src/llist_ts.h
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-10-04 09:34:06 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-10-05 12:25:48 +0200
commit1fa9564916ea9cd92622b5a549693d23fbf35bcb (patch)
tree15994eb6cbbbfc0e59c14a3de0e1635240a5c494 /src/llist_ts.h
parenta0afb7ded2fba68e710afda1053dba2a20b4665f (diff)
downloadcalcurse-1fa9564916ea9cd92622b5a549693d23fbf35bcb.zip
src/llist.c: Add llist_next_filter()
This convenience function can be used to return the successor of a list item if it is matched by a filter callback and return NULL otherwise. We will use this for an improved version of the LLIST_FIND_FOREACH macro that can be used whenever results are known to be continuous. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/llist_ts.h')
-rw-r--r--src/llist_ts.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/llist_ts.h b/src/llist_ts.h
index e7a6b3c..e152f5d 100644
--- a/src/llist_ts.h
+++ b/src/llist_ts.h
@@ -64,6 +64,8 @@ struct llist_ts {
#define LLIST_TS_FIRST(l_ts) llist_first ((llist_t *)l_ts)
#define LLIST_TS_NTH(l_ts, n) llist_nth ((llist_t *)l_ts, n)
#define LLIST_TS_NEXT(i) llist_next (i)
+#define LLIST_TS_NEXT_FILTER(i, data, fn_match) \
+ llist_next_filter (i, data, (llist_fn_match_t)fn_match)
#define LLIST_TS_FIND_FIRST(l_ts, data, fn_match) \
llist_find_first ((llist_t *)l_ts, data, (llist_fn_match_t)fn_match)
#define LLIST_TS_FIND_NEXT(i, data, fn_match) \