From 925843cfedcde221207ec1ab78f778dab22325f9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 1 Sep 2008 20:08:55 -0700 Subject: use deconst_ptr instead of duplicating deconst logic --- src/list.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/list.c') diff --git a/src/list.c b/src/list.c index 0f1f31ad4..bc158c513 100644 --- a/src/list.c +++ b/src/list.c @@ -301,11 +301,6 @@ int deleteFromList(List * list, const char *key) return 1; } -static void free_const_string(const char *p) -{ - free((char *)p); -} - void deleteNodeFromList(List * list, ListNode * node) { assert(list != NULL); @@ -326,7 +321,7 @@ void deleteNodeFromList(List * list, ListNode * node) } if (list->strdupKeys) - free_const_string(node->key); + free(deconst_ptr(node->key)); free(node); list->numberOfNodes--; @@ -353,7 +348,7 @@ void freeList(void *list) while (tmpNode != NULL) { tmpNode2 = tmpNode->nextNode; if (((List *) list)->strdupKeys) - free_const_string(tmpNode->key); + free(deconst_ptr(tmpNode->key)); if (((List *) list)->freeDataFunc) { ((List *) list)->freeDataFunc(tmpNode->data); } -- cgit v1.2.3