diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/directory.c | 34 | ||||
-rw-r--r-- | src/directory.h | 4 | ||||
-rw-r--r-- | src/main.c | 6 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/directory.c b/src/directory.c index 60bcf8ff8..2842ffa78 100644 --- a/src/directory.c +++ b/src/directory.c @@ -53,7 +53,7 @@ enum update_progress { UPDATE_PROGRESS_DONE = 2 } progress; -static Directory *mp3rootDirectory; +static Directory *music_root; static time_t directory_dbModTime; @@ -138,7 +138,7 @@ static void * update_task(void *arg) } freeList(path_list); } else { - ret = updateDirectory(mp3rootDirectory); + ret = updateDirectory(music_root); } if (ret == UPDATE_RETURN_UPDATED && writeDirectoryDB() < 0) @@ -315,7 +315,7 @@ static Directory *addDirectoryPathToDB(const char *utf8path) parent = parent_path(path_max_tmp, utf8path); if (strlen(parent) == 0) - parentDirectory = (void *)mp3rootDirectory; + parentDirectory = music_root; else parentDirectory = addDirectoryPathToDB(parent); @@ -351,7 +351,7 @@ static Directory *addParentPathToDB(const char *utf8path) parent = parent_path(path_max_tmp, utf8path); if (strlen(parent) == 0) - parentDirectory = (void *)mp3rootDirectory; + parentDirectory = music_root; else parentDirectory = addDirectoryPathToDB(parent); @@ -386,7 +386,7 @@ static enum update_return updatePath(const char *utf8path) return ret; } /* we don't want to delete the root directory */ - else if (directory == mp3rootDirectory) { + else if (directory == music_root) { free(path); return UPDATE_RETURN_NOUPDATE; } @@ -618,9 +618,9 @@ addToDirectory(Directory * directory, const char *name) return UPDATE_RETURN_ERROR; } -void closeMp3Directory(void) +void directory_finish(void) { - freeDirectory(mp3rootDirectory); + freeDirectory(music_root); } int isRootDirectory(const char *name) @@ -663,7 +663,7 @@ static Directory *getSubDirectory(Directory * directory, const char *name) static Directory *getDirectory(const char *name) { - return getSubDirectory(mp3rootDirectory, name); + return getSubDirectory(music_root, name); } static int printDirectoryList(struct client *client, struct dirvec *dv) @@ -844,11 +844,11 @@ int writeDirectoryDB(void) struct stat st; DEBUG("removing empty directories from DB\n"); - deleteEmptyDirectoriesInDirectory(mp3rootDirectory); + deleteEmptyDirectoriesInDirectory(music_root); DEBUG("sorting DB\n"); - sortDirectory(mp3rootDirectory); + sortDirectory(music_root); DEBUG("writing DB\n"); @@ -865,7 +865,7 @@ int writeDirectoryDB(void) fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, getFsCharset()); fprintf(fp, "%s\n", DIRECTORY_INFO_END); - writeDirectoryInfo(fp, mp3rootDirectory); + writeDirectoryInfo(fp, music_root); while (fclose(fp) && errno == EINTR); @@ -881,8 +881,8 @@ int readDirectoryDB(void) char *dbFile = getDbFile(); struct stat st; - if (!mp3rootDirectory) - mp3rootDirectory = newDirectory(NULL, NULL); + if (!music_root) + music_root = newDirectory(NULL, NULL); while (!(fp = fopen(dbFile, "r")) && errno == EINTR) ; if (fp == NULL) { ERROR("unable to open db file \"%s\": %s\n", @@ -943,7 +943,7 @@ int readDirectoryDB(void) DEBUG("reading DB\n"); - readDirectoryInfo(fp, mp3rootDirectory); + readDirectoryInfo(fp, music_root); while (fclose(fp) && errno == EINTR) ; stats.numberOfSongs = countSongsIn(NULL); @@ -1007,10 +1007,10 @@ int traverseAllIn(const char *name, data); } -void initMp3Directory(void) +void directory_init(void) { - mp3rootDirectory = newDirectory(NULL, NULL); - exploreDirectory(mp3rootDirectory); + music_root = newDirectory(NULL, NULL); + exploreDirectory(music_root); stats.numberOfSongs = countSongsIn(NULL); stats.dbPlayTime = sumSongTimesIn(NULL); } diff --git a/src/directory.h b/src/directory.h index bd7fcdf64..42d0e2bb6 100644 --- a/src/directory.h +++ b/src/directory.h @@ -49,9 +49,9 @@ int isUpdatingDB(void); */ int updateInit(List * pathList); -void initMp3Directory(void); +void directory_init(void); -void closeMp3Directory(void); +void directory_finish(void); int isRootDirectory(const char *name); diff --git a/src/main.c b/src/main.c index 5b8377731..202450690 100644 --- a/src/main.c +++ b/src/main.c @@ -280,7 +280,7 @@ static void openDB(Options * options, char *argv0) flushWarningLog(); if (checkDirectoryDB() < 0) exit(EXIT_FAILURE); - initMp3Directory(); + directory_init(); if (writeDirectoryDB() < 0) exit(EXIT_FAILURE); if (options->createDB) @@ -455,8 +455,8 @@ int main(int argc, char *argv[]) finishPlaylist(); start = clock(); - closeMp3Directory(); - DEBUG("closeMp3Directory took %f seconds\n", + directory_finish(); + DEBUG("directory_finish took %f seconds\n", ((float)(clock()-start))/CLOCKS_PER_SEC); deinit_main_notify(); |