diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-01 20:13:37 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-01 20:13:37 -0700 |
commit | dd7f8a723efa9c9edce951981aef7f3adf814134 (patch) | |
tree | 1c442a63c257f53d0e3f1ff127b98e682c35c4d5 /src/list.c | |
parent | cf1f842a4c8f760c4c6a41f0dadc6c173a182d4f (diff) | |
parent | 925843cfedcde221207ec1ab78f778dab22325f9 (diff) | |
download | mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.gz mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.xz mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.zip |
Merge branch 'ew/deconst'
* ew/deconst:
use deconst_ptr instead of duplicating deconst logic
provide a generic deconst_ptr function
Diffstat (limited to '')
-rw-r--r-- | src/list.c | 9 |
1 files changed, 2 insertions, 7 deletions
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); } |