diff options
Diffstat (limited to 'src/adlist.c')
-rw-r--r-- | src/adlist.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/adlist.c b/src/adlist.c index f171d3ecc..2fb61a6f1 100644 --- a/src/adlist.c +++ b/src/adlist.c @@ -52,10 +52,8 @@ list *listCreate(void) return list; } -/* Free the whole list. - * - * This function can't fail. */ -void listRelease(list *list) +/* Remove all the elements from the list without destroying the list itself. */ +void listEmpty(list *list) { unsigned long len; listNode *current, *next; @@ -68,6 +66,16 @@ void listRelease(list *list) zfree(current); current = next; } + list->head = list->tail = NULL; + list->len = 0; +} + +/* Free the whole list. + * + * This function can't fail. */ +void listRelease(list *list) +{ + listEmpty(list); zfree(list); } |