diff options
author | Max Kellermann <max@duempel.org> | 2013-10-19 17:15:17 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-19 17:15:17 +0200 |
commit | 1434e5a22e82b4176c24c536a91eefa183b78516 (patch) | |
tree | 64f2fa13494de041b1583c5c9d98d36f04447c7d /src/playlist | |
parent | 9acc1e1e97ff75e681ef5527f512e57917c617f3 (diff) | |
download | mpd-1434e5a22e82b4176c24c536a91eefa183b78516.tar.gz mpd-1434e5a22e82b4176c24c536a91eefa183b78516.tar.xz mpd-1434e5a22e82b4176c24c536a91eefa183b78516.zip |
decoder/gme,input/curl,...: use static buffers instead of g_strdup_printf()
Diffstat (limited to 'src/playlist')
-rw-r--r-- | src/playlist/PlsPlaylistPlugin.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx index 567add465..f3be73a20 100644 --- a/src/playlist/PlsPlaylistPlugin.cxx +++ b/src/playlist/PlsPlaylistPlugin.cxx @@ -37,7 +37,6 @@ static constexpr Domain pls_domain("pls"); static void pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) { - gchar *key; gchar *value; int length; GError *error = NULL; @@ -60,7 +59,9 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) while (num_entries > 0) { Song *song; - key = g_strdup_printf("File%i", num_entries); + + char key[64]; + sprintf(key, "File%u", num_entries); value = g_key_file_get_string(keyfile, "playlist", key, &error); if(error) { @@ -70,15 +71,13 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) g_free(key); return; } - g_free(key); song = Song::NewRemote(value); g_free(value); - key = g_strdup_printf("Title%i", num_entries); + sprintf(key, "Title%u", num_entries); value = g_key_file_get_string(keyfile, "playlist", key, &error); - g_free(key); if(error == NULL && value){ if (song->tag == NULL) song->tag = new Tag(); @@ -89,10 +88,9 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) error = NULL; g_free(value); - key = g_strdup_printf("Length%i", num_entries); + sprintf(key, "Length%u", num_entries); length = g_key_file_get_integer(keyfile, "playlist", key, &error); - g_free(key); if(error == NULL && length > 0){ if (song->tag == NULL) song->tag = new Tag(); |