aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dbUtils.c37
-rw-r--r--src/dbUtils.h2
-rw-r--r--src/main.c1
-rw-r--r--src/tagTracker.c2
4 files changed, 31 insertions, 11 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);
+}
diff --git a/src/dbUtils.h b/src/dbUtils.h
index df5a71656..a24311a5a 100644
--- a/src/dbUtils.h
+++ b/src/dbUtils.h
@@ -38,4 +38,6 @@ int listAllUniqueTags(FILE * fp, int type, int numConditiionals,
void printSavedMemoryFromFilenames();
+void printSavedMemoryFromDirectoryNames();
+
#endif
diff --git a/src/main.c b/src/main.c
index e1b711890..62c3a7626 100644
--- a/src/main.c
+++ b/src/main.c
@@ -433,6 +433,7 @@ int main(int argc, char * argv[]) {
printMemorySavedByTagTracker();
printSavedMemoryFromFilenames();
+ printSavedMemoryFromDirectoryNames();
daemonize(&options);
diff --git a/src/tagTracker.c b/src/tagTracker.c
index 1fe599d79..b7608ed97 100644
--- a/src/tagTracker.c
+++ b/src/tagTracker.c
@@ -97,7 +97,7 @@ void printMemorySavedByTagTracker() {
}
}
- DEBUG("saved memory: %li\n", (long)sum);
+ DEBUG("saved memory from tags: %li\n", (long)sum);
}
void sortTagTrackerInfo() {