From 267b2cd6e668fb380a53b1377143a5cc7ce949ea Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Oct 2008 18:46:52 +0200 Subject: 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. --- src/song.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/song.h') diff --git a/src/song.h b/src/song.h index f7466e24..e2e74928 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); -- cgit v1.2.3