From 1434e5a22e82b4176c24c536a91eefa183b78516 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 19 Oct 2013 17:15:17 +0200 Subject: decoder/gme,input/curl,...: use static buffers instead of g_strdup_printf() --- src/playlist/PlsPlaylistPlugin.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/playlist') 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 &songs) { - gchar *key; gchar *value; int length; GError *error = NULL; @@ -60,7 +59,9 @@ pls_parser(GKeyFile *keyfile, std::forward_list &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 &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 &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(); -- cgit v1.2.3