Commit 8867bd55 authored by Eric Wong's avatar Eric Wong Committed by Max Kellermann

tag_item: avoid wasting space when struct is unpackable

Not all compilers support struct packing, and those that don't shouldn't be punished for it.
parent c641aabe
......@@ -44,7 +44,7 @@ extern const char *mpdTagItemKeys[];
struct tag_item {
enum tag_type type;
char value[1];
char value[sizeof(long)];
} mpd_packed;
struct tag {
......
......@@ -69,7 +69,9 @@ static struct slot *slot_alloc(struct slot *next,
enum tag_type type,
const char *value, int length)
{
struct slot *slot = xmalloc(sizeof(*slot) + length);
struct slot *slot;
slot = xmalloc(sizeof(*slot) - sizeof(slot->item.value) + length + 1);
slot->next = next;
slot->ref = 1;
slot->item.type = type;
......
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