aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-08 21:20:46 +0100
committerMax Kellermann <max@duempel.org>2009-01-08 21:20:46 +0100
commit5ed5aa99acb6b8360df75bb1ce13d4b97ea50538 (patch)
tree518a01dabc3c9652fdbb090eb4e8fd97ed725729 /src/playlist_save.c
parentf0980283bcce8ad7819f71bc49b973e28e54b22d (diff)
downloadmpd-5ed5aa99acb6b8360df75bb1ce13d4b97ea50538.tar.gz
mpd-5ed5aa99acb6b8360df75bb1ce13d4b97ea50538.tar.xz
mpd-5ed5aa99acb6b8360df75bb1ce13d4b97ea50538.zip
path: allocate buffer in fs_charset conversion functions
Don't use fixed static buffers. GLib allocates a new string for us anyway, let's just return this one instead of copying it.
Diffstat (limited to 'src/playlist_save.c')
-rw-r--r--src/playlist_save.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/playlist_save.c b/src/playlist_save.c
index 054ba73f4..0913fcd09 100644
--- a/src/playlist_save.c
+++ b/src/playlist_save.c
@@ -36,27 +36,26 @@ playlist_print_song(FILE *file, const struct song *song)
g_free(path);
}
} else {
- char *uri = song_get_uri(song);
- char tmp2[MPD_PATH_MAX];
+ char *uri = song_get_uri(song), *uri_fs;
- utf8_to_fs_charset(tmp2, uri);
+ uri_fs = utf8_to_fs_charset(uri);
g_free(uri);
- fprintf(file, "%s\n", uri);
+ fprintf(file, "%s\n", uri_fs);
+ g_free(uri_fs);
}
}
void
playlist_print_uri(FILE *file, const char *uri)
{
- char tmp[MPD_PATH_MAX];
char *s;
if (playlist_saveAbsolutePaths && !uri_has_scheme(uri) &&
uri[0] != '/')
s = map_uri_fs(uri);
else
- s = g_strdup(utf8_to_fs_charset(tmp, uri));
+ s = utf8_to_fs_charset(uri);
if (s != NULL) {
fprintf(file, "%s\n", s);