From 53a749780aec9904f1c04802e12f748c2c9e3eff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 1 Nov 2009 15:54:06 +0100 Subject: database: use strcmp() instead of g_str_has_prefix() --- src/database.c | 2 +- src/directory_save.c | 6 +++--- src/song_save.c | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/database.c b/src/database.c index b7f59d29f..4d36169c7 100644 --- a/src/database.c +++ b/src/database.c @@ -284,7 +284,7 @@ db_load(GError **error) } while ((line = read_text_line(fp, buffer)) != NULL && - !g_str_has_prefix(line, DIRECTORY_INFO_END)) { + strcmp(line, DIRECTORY_INFO_END) != 0) { if (g_str_has_prefix(line, DIRECTORY_MPD_VERSION)) { if (found_version) { fclose(fp); diff --git a/src/directory_save.c b/src/directory_save.c index ed4f0190f..cb740c0c8 100644 --- a/src/directory_save.c +++ b/src/directory_save.c @@ -123,7 +123,7 @@ directory_load_subdir(FILE *fp, struct directory *parent, const char *name, } } - if (!g_str_has_prefix(line, DIRECTORY_BEGIN)) { + if (strcmp(line, DIRECTORY_BEGIN) != 0) { g_set_error(error_r, directory_quark(), 0, "Malformed line: %s", line); directory_free(directory); @@ -147,7 +147,7 @@ directory_load(FILE *fp, struct directory *directory, bool success; while ((line = read_text_line(fp, buffer)) != NULL && - !g_str_has_prefix(line, DIRECTORY_END)) { + strcmp(line, DIRECTORY_END) != 0) { if (g_str_has_prefix(line, DIRECTORY_DIR)) { struct directory *subdir = directory_load_subdir(fp, directory, @@ -157,7 +157,7 @@ directory_load(FILE *fp, struct directory *directory, return false; dirvec_add(&directory->children, subdir); - } else if (g_str_has_prefix(line, SONG_BEGIN)) { + } else if (strcmp(line, SONG_BEGIN) == 0) { success = songvec_load(fp, &directory->songs, directory, buffer, error); if (!success) diff --git a/src/song_save.c b/src/song_save.c index 4b8409d86..d931849e5 100644 --- a/src/song_save.c +++ b/src/song_save.c @@ -125,8 +125,7 @@ songvec_load(FILE *fp, struct songvec *sv, struct directory *parent, const char *value; while ((line = read_text_line(fp, buffer)) != NULL && - !g_str_has_prefix(line, SONG_END)) { - + strcmp(line, SONG_END) != 0) { if (0 == strncmp(SONG_KEY, line, strlen(SONG_KEY))) { if (song) commit_song(sv, song); -- cgit v1.2.3