Commit 53a74978 authored by Max Kellermann's avatar Max Kellermann

database: use strcmp() instead of g_str_has_prefix()

parent c5040047
...@@ -284,7 +284,7 @@ db_load(GError **error) ...@@ -284,7 +284,7 @@ db_load(GError **error)
} }
while ((line = read_text_line(fp, buffer)) != NULL && 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 (g_str_has_prefix(line, DIRECTORY_MPD_VERSION)) {
if (found_version) { if (found_version) {
fclose(fp); fclose(fp);
......
...@@ -123,7 +123,7 @@ directory_load_subdir(FILE *fp, struct directory *parent, const char *name, ...@@ -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, g_set_error(error_r, directory_quark(), 0,
"Malformed line: %s", line); "Malformed line: %s", line);
directory_free(directory); directory_free(directory);
...@@ -147,7 +147,7 @@ directory_load(FILE *fp, struct directory *directory, ...@@ -147,7 +147,7 @@ directory_load(FILE *fp, struct directory *directory,
bool success; bool success;
while ((line = read_text_line(fp, buffer)) != NULL && 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)) { if (g_str_has_prefix(line, DIRECTORY_DIR)) {
struct directory *subdir = struct directory *subdir =
directory_load_subdir(fp, directory, directory_load_subdir(fp, directory,
...@@ -157,7 +157,7 @@ directory_load(FILE *fp, struct directory *directory, ...@@ -157,7 +157,7 @@ directory_load(FILE *fp, struct directory *directory,
return false; return false;
dirvec_add(&directory->children, subdir); 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, success = songvec_load(fp, &directory->songs,
directory, buffer, error); directory, buffer, error);
if (!success) if (!success)
......
...@@ -125,8 +125,7 @@ songvec_load(FILE *fp, struct songvec *sv, struct directory *parent, ...@@ -125,8 +125,7 @@ songvec_load(FILE *fp, struct songvec *sv, struct directory *parent,
const char *value; const char *value;
while ((line = read_text_line(fp, buffer)) != NULL && 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 (0 == strncmp(SONG_KEY, line, strlen(SONG_KEY))) {
if (song) if (song)
commit_song(sv, song); commit_song(sv, song);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment