From 21b5cde43ac7c82b1848145456b98e2c5b8e6cb1 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Thu, 11 Nov 2004 04:34:26 +0000 Subject: ok, optimize memory sage of directorys, by iteratively creating the directories, this code needs some serious testing: Note: The song name optimization i think is worth it, saves about 200k of ram on my syste, however, having to create directory names iteratively each time we print probably isn't worth the cpu. We only save about 10k of ram for the computer todo alot more work, and the code maybe a little messier git-svn-id: https://svn.musicpd.org/mpd/trunk@2604 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/dbUtils.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/dbUtils.c') diff --git a/src/dbUtils.c b/src/dbUtils.c index 3699ab72a..51e991130 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -60,8 +60,8 @@ int countSongsInDirectory(FILE * fp, Directory * directory, void * data) { } int printDirectoryInDirectory(FILE * fp, Directory * directory, void * data) { - if(directory->utf8name) { - myfprintf(fp,"directory: %s\n",directory->utf8name); + if(directory->name) { + myfprintf(fp,"directory: %s\n", getDirectoryPath(directory)); } return 0; } @@ -273,13 +273,15 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals, int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) { int * sum = data; - if(!dir->utf8name) return 0; + if(!dir->name) return 0; - *sum += (strlen(dir->utf8name)+1-sizeof(Directory *))* + *sum += (strlen(getDirectoryPath(dir))+1-sizeof(Directory *))* dir->songs->numberOfNodes; - /**sum += (strlen(dir->utf8name)+1)* - dir->subDirectories->numberOfNodes;*/ + *sum += (strlen(getDirectoryPath(dir))+1)* + dir->subDirectories->numberOfNodes; + + *sum += strlen(dir->name)+1; return 0; } -- cgit v1.2.3