aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.h
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.h
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 'src/song.h')
-rw-r--r--src/song.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/song.h b/src/song.h
index f7466e24c..e2e74928b 100644
--- a/src/song.h
+++ b/src/song.h
@@ -20,6 +20,7 @@
#define SONG_H
#include "os_compat.h"
+#include "gcc.h"
#define SONG_BEGIN "songList begin"
#define SONG_END "songList end"
@@ -35,12 +36,15 @@ enum song_type {
struct client;
typedef struct _Song {
- char *url;
enum song_type type;
struct tag *tag;
struct _Directory *parentDir;
time_t mtime;
-} Song;
+ char url[1];
+} mpd_packed Song;
+
+Song *
+song_alloc(const char *url, enum song_type type, struct _Directory *parent);
Song *newSong(const char *url, enum song_type type,
struct _Directory *parentDir);