aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_save.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-06 18:46:52 +0200
committerMax Kellermann <max@duempel.org>2008-10-06 18:46:52 +0200
commit267b2cd6e668fb380a53b1377143a5cc7ce949ea (patch)
treea1cea3d612df1e029f7ffb87b46f28b36a0a2d22 /src/song_save.c
parent43761441c9bbb763ccde3ae2f7f5508f5cec70ec (diff)
downloadmpd-267b2cd6e668fb380a53b1377143a5cc7ce949ea.tar.gz
mpd-267b2cd6e668fb380a53b1377143a5cc7ce949ea.tar.xz
mpd-267b2cd6e668fb380a53b1377143a5cc7ce949ea.zip
song: use flex arrays to store song->url
Reduce the number of allocations we make, so there's less pressure on the allocator and less overhead to keep track of the allocations in.
Diffstat (limited to '')
-rw-r--r--src/song_save.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/song_save.c b/src/song_save.c
index 3cb17f97b..1daf2fe32 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -111,18 +111,14 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
if (song)
insertSongIntoList(sv, song);
- song = xmalloc(sizeof(*song));
- song->url = xstrdup(buffer + strlen(SONG_KEY));
- song->type = SONG_TYPE_FILE;
- song->parentDir = parentDir;
+ song = song_alloc(buffer + strlen(SONG_KEY),
+ SONG_TYPE_FILE, parentDir);
} else if (*buffer == 0) {
/* ignore empty lines (starting with '\0') */
} else if (song == NULL) {
FATAL("Problems reading song info\n");
} else if (0 == strncmp(SONG_FILE, buffer, strlen(SONG_FILE))) {
- /* we don't need this info anymore
- song->url = xstrdup(&(buffer[strlen(SONG_FILE)]));
- */
+ /* we don't need this info anymore */
} else if (matchesAnMpdTagItemKey(buffer, &itemType)) {
if (!song->tag) {
song->tag = tag_new();