summaryrefslogtreecommitdiff
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-10-26 18:26:01 +0200
committerMax Kellermann <max@musicpd.org>2016-10-26 18:26:01 +0200
commit9c1c180ae03917f0209146961b6ef3336b48b519 (patch)
treebf922aaecf4693e08bd18ba9046d112a74e59416 /src/tag
parent06682bd2a95692153327b483a06ffa709a842e6b (diff)
tag/Item: declare value[] to have only one element
By declaring the variable-length array to have a nominal size of 1, struct TagPoolSlot shrinks from 24 bytes to 16 bytes, because "ref" and "item" now both fit in one machine word.
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/TagItem.hxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tag/TagItem.hxx b/src/tag/TagItem.hxx
index 86c9646ef..ebea73ac1 100644
--- a/src/tag/TagItem.hxx
+++ b/src/tag/TagItem.hxx
@@ -34,13 +34,14 @@ struct TagItem {
/**
* the value of this tag; this is a variable length string
*/
- char value[sizeof(long) - sizeof(type)];
+ char value[1];
TagItem() = default;
TagItem(const TagItem &other) = delete;
TagItem &operator=(const TagItem &other) = delete;
};
+static_assert(sizeof(TagItem) == 2, "Unexpected size");
static_assert(alignof(TagItem) == 1, "Unexpected alignment");
#endif