aboutsummaryrefslogtreecommitdiffstats
path: root/src/stored_playlist.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/stored_playlist.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/stored_playlist.c')
-rw-r--r--src/stored_playlist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stored_playlist.c b/src/stored_playlist.c
index a503c2841..e6fdf944a 100644
--- a/src/stored_playlist.c
+++ b/src/stored_playlist.c
@@ -37,7 +37,7 @@ static struct stored_playlist_info *
load_playlist_info(const char *parent_path_fs, const char *name_fs)
{
size_t name_length = strlen(name_fs);
- char buffer[MPD_PATH_MAX], *path_fs, *name, *name_utf8;
+ char *path_fs, *name, *name_utf8;
int ret;
struct stat st;
struct stored_playlist_info *playlist;
@@ -60,13 +60,13 @@ load_playlist_info(const char *parent_path_fs, const char *name_fs)
name = g_strdup(name_fs);
name[name_length - sizeof(PLAYLIST_FILE_SUFFIX)] = 0;
- name_utf8 = fs_charset_to_utf8(buffer, name);
+ name_utf8 = fs_charset_to_utf8(name);
g_free(name);
if (name_utf8 == NULL)
return NULL;
playlist = g_new(struct stored_playlist_info, 1);
- playlist->name = g_strdup(name_utf8);
+ playlist->name = name_utf8;
playlist->mtime = st.st_mtime;
return playlist;
}