database: use strcmp() instead of g_str_has_prefix()

This commit is contained in:
Max Kellermann 2009-11-01 15:54:06 +01:00
parent c504004702
commit 53a749780a
3 changed files with 5 additions and 6 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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);