aboutsummaryrefslogtreecommitdiffstats
path: root/src/list.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 19:14:39 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 19:14:39 +0200
commit4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a (patch)
treefe980e309ed81201e44f612968d4bf04825bf36f /src/list.c
parentb67bb05d05aef568a2614943625386a8cd67690d (diff)
downloadmpd-4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a.tar.gz
mpd-4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a.tar.xz
mpd-4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a.zip
fix -Wcast-qual -Wwrite-strings warnings
The previous patch enabled these warnings. In Eric's branch, they were worked around with a generic deconst_ptr() function. There are several places where we can add "const" to pointers, and in others, libraries want non-const strings. In the latter, convert string literals to "static char[]" variables - this takes the same space, and seems safer than deconsting a string literal.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/list.c b/src/list.c
index 0f1f31ad4..01da7bdab 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);
+ xfree(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);
+ xfree(tmpNode->key);
if (((List *) list)->freeDataFunc) {
((List *) list)->freeDataFunc(tmpNode->data);
}