aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-11 02:36:25 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-11 02:36:25 +0000
commit4ec3df033954d01663087011efecfca37749f965 (patch)
treeecf4d199b1c4ea3cbbb78c0904a3ba9a4e00efc9 /src/dbUtils.c
parent03f02badf02adba317f6358bc0e1ebf669b48204 (diff)
downloadmpd-4ec3df033954d01663087011efecfca37749f965.tar.gz
mpd-4ec3df033954d01663087011efecfca37749f965.tar.xz
mpd-4ec3df033954d01663087011efecfca37749f965.zip
implement saved memory by not storing full path
git-svn-id: https://svn.musicpd.org/mpd/trunk@2601 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r--src/dbUtils.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 63f1f33b7..55791653f 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -6,6 +6,7 @@
#include "playlist.h"
#include "tag.h"
#include "tagTracker.h"
+#include "log.h"
#define LOCATE_TAG_FILE_TYPE TAG_NUM_OF_ITEM_TYPES+10
#define LOCATE_TAG_FILE_KEY "filename"
@@ -76,7 +77,7 @@ static inline int strstrSearchTag(Song * song, int type, char * str) {
int ret = 0;
if(type == LOCATE_TAG_FILE_TYPE) {
- dup = strDupToUpper(song->utf8url);
+ dup = strDupToUpper(getSongUrl(song));
if(strstr(dup, str)) ret = 1;
free(dup);
return ret;
@@ -122,7 +123,7 @@ static inline int tagItemFoundAndMatches(Song * song, int type, char * str) {
int i;
if(type == LOCATE_TAG_FILE_TYPE) {
- if(0 == strcmp(str, song->utf8url)) return 1;
+ if(0 == strcmp(str, getSongUrl(song))) return 1;
}
if(!song->tag) return 0;
@@ -217,7 +218,7 @@ void printUnvisitedTags(FILE * fp, Song * song, int tagType) {
MpdTag * tag = song->tag;
if(tagType == LOCATE_TAG_FILE_TYPE) {
- myfprintf(fp, "file: %s\n", song->utf8url);
+ printSongUrl(fp, song);
return;
}
@@ -268,3 +269,23 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals,
return ret;
}
+
+int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
+ int * sum = data;
+
+ if(!dir->utf8name) return 0;
+
+ *sum += (strlen(dir->utf8name)+1-sizeof(Directory *))*
+ dir->songs->numberOfNodes;
+
+ return 0;
+}
+
+void printSavedMemoryFromFilenames() {
+ int sum;
+
+ traverseAllIn(stderr, NULL, NULL, sumSavedMemoryInDirectory,
+ (void *)&sum);
+
+ DEBUG("saved memory from filenames: %i\n", sum);
+}