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:
parent
267b2cd6e6
commit
22e40b61cc
@ -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 *
|
||||
|
Loading…
Reference in New Issue
Block a user