From c024fd0c76bc305cd6b6bab0989226bd9ec5e763 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 15 Jun 2006 12:43:09 +0000 Subject: [lib] list_delete shouldn't duplicate list_delete_all_node 2006-06-15 Paul Jakma * linklist.c: (list_delete) call list_delete_all_node, don't duplicate it. --- lib/ChangeLog | 2 ++ lib/linklist.c | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/ChangeLog b/lib/ChangeLog index b7c9f040..a9c3b8bf 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -3,6 +3,8 @@ * command.c: (cmd_describe_command_real) Fix leak, CID #38. * memory.h: Experimental, have XFREE macro NULL out the freed pointer. + * linklist.c: (list_delete) call list_delete_all_node, don't + duplicate it. 2006-05-28 Paul Jakma diff --git a/lib/linklist.c b/lib/linklist.c index 71c4db82..11e16a8a 100644 --- a/lib/linklist.c +++ b/lib/linklist.c @@ -226,17 +226,8 @@ list_delete_all_node (struct list *list) void list_delete (struct list *list) { - struct listnode *node; - struct listnode *next; - assert(list); - for (node = list->head; node; node = next) - { - next = node->next; - if (list->del) - (*list->del) (node->data); - listnode_free (node); - } + list_delete_all_node (list); list_free (list); } -- cgit v1.2.1