aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-28 20:33:56 +0100
committerMax Kellermann <max@duempel.org>2008-10-28 20:33:56 +0100
commit016d996131d560db6d72476ae29c74df84746fff (patch)
treec22a7d13e1b39927e70e73cbc8f78762fba0d92a /src/directory_save.c
parent4a71f66256d02c46bc2bb3665cc6451a2101d5ac (diff)
downloadmpd-016d996131d560db6d72476ae29c74df84746fff.tar.gz
mpd-016d996131d560db6d72476ae29c74df84746fff.tar.xz
mpd-016d996131d560db6d72476ae29c74df84746fff.zip
utils: use g_str_has_prefix() instead of prefixcmp()
Remove duplicated code from MPD.
Diffstat (limited to 'src/directory_save.c')
-rw-r--r--src/directory_save.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/directory_save.c b/src/directory_save.c
index 7ee5cbb02..352b808cf 100644
--- a/src/directory_save.c
+++ b/src/directory_save.c
@@ -71,22 +71,22 @@ directory_load(FILE *fp, struct directory *directory)
char *name;
while (myFgets(buffer, bufferSize, fp)
- && prefixcmp(buffer, DIRECTORY_END)) {
- if (!prefixcmp(buffer, DIRECTORY_DIR)) {
+ && !g_str_has_prefix(buffer, DIRECTORY_END)) {
+ if (g_str_has_prefix(buffer, DIRECTORY_DIR)) {
struct directory *subdir;
strcpy(key, &(buffer[strlen(DIRECTORY_DIR)]));
if (!myFgets(buffer, bufferSize, fp))
FATAL("Error reading db, fgets\n");
/* for compatibility with db's prior to 0.11 */
- if (!prefixcmp(buffer, DIRECTORY_MTIME)) {
+ if (g_str_has_prefix(buffer, DIRECTORY_MTIME)) {
if (!myFgets(buffer, bufferSize, fp))
FATAL("Error reading db, fgets\n");
}
- if (prefixcmp(buffer, DIRECTORY_BEGIN))
+ if (!g_str_has_prefix(buffer, DIRECTORY_BEGIN))
FATAL("Error reading db at line: %s\n", buffer);
name = &(buffer[strlen(DIRECTORY_BEGIN)]);
- if (prefixcmp(name, directory->path) != 0)
+ if (!g_str_has_prefix(name, directory->path) != 0)
FATAL("Wrong path in database: '%s' in '%s'\n",
name, directory->path);
@@ -98,7 +98,7 @@ directory_load(FILE *fp, struct directory *directory)
dirvec_add(&directory->children, subdir);
}
directory_load(fp, subdir);
- } else if (!prefixcmp(buffer, SONG_BEGIN)) {
+ } else if (g_str_has_prefix(buffer, SONG_BEGIN)) {
readSongInfoIntoList(fp, &directory->songs, directory);
} else {
FATAL("Unknown line in db: %s\n", buffer);