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>
This commit is contained in:
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user