playlist/pls: simplify error handler

Don't pass a GError** to g_key_file_get_X().  We don't need to dispose
something we didn't request in the first place.
This commit is contained in:
Max Kellermann 2014-01-08 19:27:22 +01:00
parent 2071070f39
commit 5c6fe97b35

View File

@ -81,25 +81,18 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
sprintf(key, "Title%u", num_entries); sprintf(key, "Title%u", num_entries);
value = g_key_file_get_string(keyfile, "playlist", key, value = g_key_file_get_string(keyfile, "playlist", key,
&error); nullptr);
if (error == nullptr && value != nullptr) if (value != nullptr)
tag.AddItem(TAG_TITLE, value); tag.AddItem(TAG_TITLE, value);
/* Ignore errors? Most likely value not present */
if(error) g_error_free(error);
error = nullptr;
g_free(value); g_free(value);
sprintf(key, "Length%u", num_entries); sprintf(key, "Length%u", num_entries);
length = g_key_file_get_integer(keyfile, "playlist", key, length = g_key_file_get_integer(keyfile, "playlist", key,
&error); nullptr);
if (error == nullptr && length > 0) if (length > 0)
tag.SetTime(length); tag.SetTime(length);
/* Ignore errors? Most likely value not present */
if(error) g_error_free(error);
error = nullptr;
song->tag = tag.CommitNew(); song->tag = tag.CommitNew();
songs.emplace_front(song); songs.emplace_front(song);
num_entries--; num_entries--;