summaryrefslogtreecommitdiff
path: root/source/q_list.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/q_list.h')
-rw-r--r--source/q_list.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/q_list.h b/source/q_list.h
index 2e1828b..a254cab 100644
--- a/source/q_list.h
+++ b/source/q_list.h
@@ -84,6 +84,16 @@ static inline void List_Remove( list_t *elem ) {
#define LIST_PREV( type, entry, member ) \
LIST_ENTRY( type, (entry)->member.prev, member )
+#define LIST_NEXT_CYCLE( type, entry, list, member ) \
+ ( (entry)->member.next == list ? \
+ LIST_FIRST( type, list, member ) : \
+ LIST_NEXT( type, entry, member ) )
+
+#define LIST_PREV_CYCLE( type, entry, list, member ) \
+ ( (entry)->member.prev == list ? \
+ LIST_LAST( type, list, member ) : \
+ LIST_PREV( type, entry, member ) )
+
#define LIST_FOR_EACH( type, cursor, list, member ) \
for( cursor = LIST_FIRST( type, list, member ); \
&(cursor)->member != list; \