summaryrefslogtreecommitdiffstats
path: root/src/llist_ts.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/llist_ts.h')
-rw-r--r--src/llist_ts.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/llist_ts.h b/src/llist_ts.h
index 0f90024..b452377 100644
--- a/src/llist_ts.h
+++ b/src/llist_ts.h
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2011 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2012 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,8 +37,9 @@
/* Thread-safe linked lists. */
typedef struct llist_ts llist_ts_t;
struct llist_ts {
- llist_item_t *head;
- pthread_mutex_t mutex;
+ llist_item_t *head;
+ llist_item_t *tail;
+ pthread_mutex_t mutex;
};
/* Initialization and deallocation. */
@@ -63,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) \
@@ -75,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)
@@ -84,4 +90,3 @@ struct llist_ts {
#define LLIST_TS_REMOVE(l_ts, i) llist_remove ((llist_t *)l_ts, i)
#define LLIST_TS_ADD_SORTED(l_ts, data, fn_cmp) \
llist_add_sorted ((llist_t *)l_ts, data, (llist_fn_cmp_t)fn_cmp)
-