diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-11-11 02:36:25 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-11-11 02:36:25 +0000 |
commit | 4ec3df033954d01663087011efecfca37749f965 (patch) | |
tree | ecf4d199b1c4ea3cbbb78c0904a3ba9a4e00efc9 /src/directory.c | |
parent | 03f02badf02adba317f6358bc0e1ebf669b48204 (diff) | |
download | mpd-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/directory.c')
-rw-r--r-- | src/directory.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/directory.c b/src/directory.c index 5ac78afaf..18c0b7c92 100644 --- a/src/directory.c +++ b/src/directory.c @@ -280,8 +280,8 @@ void removeSongFromDirectory(Directory * directory, char * shortname) { void * song; if(findInList(directory->songs,shortname,&song)) { - LOG("removing: %s\n",((Song *)song)->utf8url); - deleteFromList(directory->songs,shortname); + LOG("removing: %s\n", getSongUrl((Song *)song)); + deleteFromList(directory->songs, shortname); } } @@ -317,7 +317,7 @@ int updateInDirectory(Directory * directory, char * shortname, char * name) { if(S_ISREG(st.st_mode) && hasMusicSuffix(name)) { if(0==findInList(directory->songs,shortname,&song)) { - addToDirectory(directory,shortname,name); + addToDirectory(directory, shortname, name); return DIRECTORY_RETURN_UPDATE; } else if(st.st_mtime!=((Song *)song)->mtime) { @@ -540,7 +540,7 @@ int updatePath(char * utf8path) { parentDirectory->parent, parentDirectory->stat->inode, parentDirectory->stat->device) && - song && isMusic(song->utf8url,&mtime)) + song && isMusic(getSongUrl(song), &mtime)) { free(path); if(song->mtime==mtime) return 0; @@ -553,7 +553,7 @@ int updatePath(char * utf8path) { } /* if updateDirectory fials, means we should delete it */ else { - removeSongFromDirectory(parentDirectory,shortname); + removeSongFromDirectory(parentDirectory, shortname); ret = 1; /* don't return, path maybe a directory now*/ } @@ -749,10 +749,10 @@ int addToDirectory(Directory * directory, char * shortname, char * name) { if(S_ISREG(st.st_mode) && hasMusicSuffix(name)) { Song * song; - song = addSongToList(directory->songs,shortname,name, - SONG_TYPE_FILE); + song = addSongToList(directory->songs, shortname, name, + SONG_TYPE_FILE, directory); if(!song) return -1; - LOG("added %s\n",name); + LOG("added %s\n", name); return 1; } else if(S_ISDIR(st.st_mode)) { @@ -935,7 +935,7 @@ void readDirectoryInfo(FILE * fp,Directory * directory) { readDirectoryInfo(fp,subDirectory); } else if(0==strncmp(SONG_BEGIN,buffer,strlen(SONG_BEGIN))) { - readSongInfoIntoList(fp,directory->songs); + readSongInfoIntoList(fp, directory->songs, directory); } else { ERROR("Unknown line in db: %s\n",buffer); |