/* adlist.h - A generic doubly linked list implementation
*
- * Copyright (c) 2006-2009, Salvatore Sanfilippo <antirez at gmail dot com>
+ * Copyright (c) 2006-2010, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
void *value;
} listNode;
+typedef struct listIter {
+ listNode *next;
+ int direction;
+} listIter;
+
typedef struct list {
listNode *head;
listNode *tail;
unsigned int len;
} 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)
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, listIter *li);
+void listRewindTail(list *list, listIter *li);
/* Directions for iterators */
#define AL_START_HEAD 0