song: don't make the struct packed

The "packed" attribute may have negative side effects on performance.
Remove the "packed" attribute, and increase the size of "song.url" to
a multiple of the machine word size.
This commit is contained in:
Max Kellermann 2008-10-06 18:48:45 +02:00
parent 267b2cd6e6
commit 22e40b61cc
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ Song *
song_alloc(const char *url, enum song_type type, struct _Directory *parent)
{
size_t urllen = strlen(url);
Song *song = xmalloc(sizeof(Song) + urllen);
Song *song = xmalloc(sizeof(*song) - sizeof(song->url) + urllen + 1);
song->tag = NULL;
memcpy(song->url, url, urllen + 1);

View File

@ -40,7 +40,7 @@ typedef struct _Song {
struct tag *tag;
struct _Directory *parentDir;
time_t mtime;
char url[1];
char url[sizeof(size_t)];
} mpd_packed Song;
Song *