Commit 22e40b61 authored by Max Kellermann's avatar Max Kellermann

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.
parent 267b2cd6
......@@ -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);
......
......@@ -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 *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment