Commit c4bb227b authored by Max Kellermann's avatar Max Kellermann

database: eliminate "goto" usage

parent a45922cd
...@@ -96,7 +96,7 @@ db_get_directory(const char *name) ...@@ -96,7 +96,7 @@ db_get_directory(const char *name)
struct song * struct song *
db_get_song(const char *file) db_get_song(const char *file)
{ {
struct song *song = NULL; struct song *song;
struct directory *directory; struct directory *directory;
char *duplicated, *shortname, *dir; char *duplicated, *shortname, *dir;
...@@ -118,13 +118,14 @@ db_get_song(const char *file) ...@@ -118,13 +118,14 @@ db_get_song(const char *file)
dir = duplicated; dir = duplicated;
} }
if (!(directory = db_get_directory(dir))) directory = db_get_directory(dir);
goto out; if (directory != NULL)
if (!(song = songvec_find(&directory->songs, shortname))) song = songvec_find(&directory->songs, shortname);
goto out; else
assert(song->parent == directory); song = NULL;
assert(song == NULL || song->parent == directory);
out:
g_free(duplicated); g_free(duplicated);
return song; return 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