aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dbUtils.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 51e991130..60344a291 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -270,7 +270,7 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals,
return ret;
}
-int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
+int sumSavedFilenameMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
int * sum = data;
if(!dir->name) return 0;
@@ -278,15 +278,10 @@ int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
*sum += (strlen(getDirectoryPath(dir))+1-sizeof(Directory *))*
dir->songs->numberOfNodes;
- *sum += (strlen(getDirectoryPath(dir))+1)*
- dir->subDirectories->numberOfNodes;
-
- *sum += strlen(dir->name)+1;
-
return 0;
}
-int sumSavedMemoryInSong(FILE * fp, Song * song, void * data) {
+int sumSavedFilenameMemoryInSong(FILE * fp, Song * song, void * data) {
int * sum = data;
*sum += strlen(song->url)+1;
@@ -295,10 +290,32 @@ int sumSavedMemoryInSong(FILE * fp, Song * song, void * data) {
}
void printSavedMemoryFromFilenames() {
- int sum;
+ int sum = 0;
- traverseAllIn(stderr, NULL, sumSavedMemoryInSong,
- sumSavedMemoryInDirectory, (void *)&sum);
+ traverseAllIn(stderr, NULL, sumSavedFilenameMemoryInSong,
+ sumSavedFilenameMemoryInDirectory, (void *)&sum);
DEBUG("saved memory from filenames: %i\n", sum);
}
+
+int sumSavedDirectoryNameMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
+ int * sum = data;
+
+ if(!dir->name) return 0;
+
+ *sum += (strlen(getDirectoryPath(dir))+1)*
+ dir->subDirectories->numberOfNodes;
+
+ *sum += strlen(dir->name)+1;
+
+ return 0;
+}
+
+void printSavedMemoryFromDirectoryNames() {
+ int sum = 0;
+
+ traverseAllIn(stderr, NULL, NULL,
+ sumSavedDirectoryNameMemoryInDirectory, (void *)&sum);
+
+ DEBUG("saved memory from directory names: %i\n", sum);
+}