song: song_file_update() returns bool

Instead of returning 0 or -1, return true on success and false on
failure.  This seems more natural, and when the C library was
designed, there was no "bool" data type.
This commit is contained in:
Max Kellermann 2008-10-08 11:06:26 +02:00
parent 1f9b614850
commit 02e8c000d1
3 changed files with 6 additions and 6 deletions

View File

@ -97,7 +97,7 @@ song_free(struct song *song)
free(song); free(song);
} }
int bool
song_file_update(struct song *song) song_file_update(struct song *song)
{ {
struct decoder_plugin *plugin; struct decoder_plugin *plugin;
@ -120,9 +120,9 @@ song_file_update(struct song *song)
song->tag = plugin->tag_dup(abs_path); song->tag = plugin->tag_dup(abs_path);
if (song->tag == NULL || song->tag->time < 0) if (song->tag == NULL || song->tag->time < 0)
return -1; return false;
return 0; return true;
} }
char * char *

View File

@ -55,7 +55,7 @@ song_file_load(const char *path, struct directory *parent);
void void
song_free(struct song *song); song_free(struct song *song);
int bool
song_file_update(struct song *song); song_file_update(struct song *song);
/* /*

View File

@ -232,7 +232,7 @@ updateInDirectory(struct directory *directory, const char *name)
return UPDATE_RETURN_UPDATED; return UPDATE_RETURN_UPDATED;
} else if (st.st_mtime != song->mtime) { } else if (st.st_mtime != song->mtime) {
LOG("updating %s\n", name); LOG("updating %s\n", name);
if (song_file_update(song) < 0) if (!song_file_update(song))
delete_song(directory, song); delete_song(directory, song);
return UPDATE_RETURN_UPDATED; return UPDATE_RETURN_UPDATED;
} }
@ -421,7 +421,7 @@ static enum update_return updatePath(const char *utf8path)
free(path); free(path);
if (song->mtime == mtime) if (song->mtime == mtime)
return UPDATE_RETURN_NOUPDATE; return UPDATE_RETURN_NOUPDATE;
else if (song_file_update(song) == 0) else if (song_file_update(song))
return UPDATE_RETURN_UPDATED; return UPDATE_RETURN_UPDATED;
else { else {
delete_song(parentDirectory, song); delete_song(parentDirectory, song);