diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-11-10 12:24:33 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-11-10 12:24:33 +0000 |
commit | 04a23441e116b8c7c6a8786a961dcafec2c789a5 (patch) | |
tree | 5ccc94eb45d187f83e57303d395954581de2102f /src/tagTracker.c | |
parent | 8bba38177e4e85b9b6f2f48f826b6e829dceb11a (diff) | |
download | mpd-04a23441e116b8c7c6a8786a961dcafec2c789a5.tar.gz mpd-04a23441e116b8c7c6a8786a961dcafec2c789a5.tar.xz mpd-04a23441e116b8c7c6a8786a961dcafec2c789a5.zip |
some more fixes
git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2573 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/tagTracker.c')
-rw-r--r-- | src/tagTracker.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/tagTracker.c b/src/tagTracker.c index 7bca526a7..23110c682 100644 --- a/src/tagTracker.c +++ b/src/tagTracker.c @@ -1,6 +1,7 @@ #include "tagTracker.h" #include "list.h" +#include "log.h" #include <assert.h> @@ -19,11 +20,12 @@ char * getTagItemString(int type, char * string) { ListNode * node; if(tagLists[type] == NULL) { - tagLists[type] = makeList(NULL); + tagLists[type] = makeList(free); } if((node = findNodeInList(tagLists[type], string))) { (*((int *)node->data))++; + printf("%s: %i\n", string, *((int *)node->data)); } else { int * intPtr = malloc(sizeof(int)); @@ -37,6 +39,8 @@ char * getTagItemString(int type, char * string) { void removeTagItemString(int type, char * string) { ListNode * node; + assert(tagLists[type]); + assert(string); if(tagLists[type] == NULL) return; node = findNodeInList(tagLists[type], string); @@ -58,3 +62,22 @@ int getNumberOfTagItems(int type) { return tagLists[type]->numberOfNodes; } + +void printMemorySavedByTagTracker() { + int i; + ListNode * node; + size_t sum = 0; + + for(i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) { + if(!tagLists[i]) continue; + + node = tagLists[i]->firstNode; + + while(node != NULL) { + sum += (strlen(node->key)+1)*(*((int *)node->data)); + node = node->nextNode; + } + } + + DEBUG("saved memory: %li\n", (long)sum); +} |