aboutsummaryrefslogtreecommitdiffstats
path: root/src/llist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/llist.h')
-rw-r--r--src/llist.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/llist.h b/src/llist.h
index d7e4249..8833c66 100644
--- a/src/llist.h
+++ b/src/llist.h
@@ -44,6 +44,7 @@ struct llist_item {
typedef struct llist llist_t;
struct llist {
struct llist_item *head;
+ struct llist_item *tail;
};
typedef int (*llist_fn_cmp_t) (void *, void *);
@@ -64,6 +65,7 @@ void llist_free_inner (llist_t *, llist_fn_free_t);
llist_item_t *llist_first (llist_t *);
llist_item_t *llist_nth (llist_t *, int);
llist_item_t *llist_next (llist_item_t *);
+llist_item_t *llist_next_filter (llist_item_t *, long, llist_fn_match_t);
llist_item_t *llist_find_first (llist_t *, long, llist_fn_match_t);
llist_item_t *llist_find_next (llist_item_t *, long, llist_fn_match_t);
llist_item_t *llist_find_nth (llist_t *, int, long, llist_fn_match_t);
@@ -71,6 +73,8 @@ llist_item_t *llist_find_nth (llist_t *, int, long, llist_fn_match_t);
#define LLIST_FIRST(l) llist_first(l)
#define LLIST_NTH(l, n) llist_nth(l, n)
#define LLIST_NEXT(i) llist_next(i)
+#define LLIST_NEXT_FILTER(i, data, fn_match) \
+ llist_next_filter(i, data, (llist_fn_match_t)fn_match)
#define LLIST_FIND_FIRST(l, data, fn_match) \
llist_find_first(l, data, (llist_fn_match_t)fn_match)
#define LLIST_FIND_NEXT(i, data, fn_match) \
@@ -82,6 +86,9 @@ llist_item_t *llist_find_nth (llist_t *, int, long, llist_fn_match_t);
#define LLIST_FIND_FOREACH(l, data, fn_match, i) \
for (i = LLIST_FIND_FIRST (l, data, fn_match); i; \
i = LLIST_FIND_NEXT (i, data, fn_match))
+#define LLIST_FIND_FOREACH_CONT(l, data, fn_match, i) \
+ for (i = LLIST_FIND_FIRST (l, data, fn_match); i; \
+ i = LLIST_NEXT_FILTER (i, data, fn_match))
/* Accessing list item data. */
void *llist_get_data (llist_item_t *);