X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/ed9b544e10b84cd43348ddfab7068b610a5df1f7..774230260ff61dbc143236f690ccc73048f7fdfe:/adlist.h diff --git a/adlist.h b/adlist.h index 43476c0a..4d32fef5 100644 --- a/adlist.h +++ b/adlist.h @@ -39,6 +39,11 @@ typedef struct listNode { void *value; } listNode; +typedef struct listIter { + listNode *next; + int direction; +} listIter; + typedef struct list { listNode *head; listNode *tail; @@ -46,14 +51,9 @@ typedef struct list { void (*free)(void *ptr); int (*match)(void *ptr, void *key); unsigned int len; + listIter iter; } list; -typedef struct listIter { - listNode *next; - listNode *prev; - int direction; -} listIter; - /* Functions implemented as macros */ #define listLength(l) ((l)->len) #define listFirst(l) ((l)->head) @@ -77,11 +77,14 @@ list *listAddNodeHead(list *list, void *value); list *listAddNodeTail(list *list, void *value); void listDelNode(list *list, listNode *node); listIter *listGetIterator(list *list, int direction); -listNode *listNextElement(listIter *iter); +listNode *listNext(listIter *iter); void listReleaseIterator(listIter *iter); list *listDup(list *orig); listNode *listSearchKey(list *list, void *key); listNode *listIndex(list *list, int index); +void listRewind(list *list); +void listRewindTail(list *list); +listNode *listYield(list *list); /* Directions for iterators */ #define AL_START_HEAD 0