From 04bc9005aeeebc7b1af90f74c4873b3a835d67ac Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Sep 2013 18:14:58 +0200 Subject: TagType: reduce the enum size to 1 byte Reduce the TagItem overhead. --- src/tag/TagItem.hxx | 2 +- src/tag/TagType.h | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/tag') diff --git a/src/tag/TagItem.hxx b/src/tag/TagItem.hxx index f661a273b..a2924f2af 100644 --- a/src/tag/TagItem.hxx +++ b/src/tag/TagItem.hxx @@ -35,7 +35,7 @@ struct TagItem { /** * the value of this tag; this is a variable length string */ - char value[sizeof(long)]; + char value[sizeof(long) - sizeof(type)]; TagItem() = default; TagItem(const TagItem &other) = delete; diff --git a/src/tag/TagType.h b/src/tag/TagType.h index 8df595889..118d66a02 100644 --- a/src/tag/TagType.h +++ b/src/tag/TagType.h @@ -20,10 +20,21 @@ #ifndef MPD_TAG_TYPE_H #define MPD_TAG_TYPE_H +#ifdef __cplusplus +#include +#endif + /** * Codes for the type of a tag item. */ -enum tag_type { +enum tag_type +#ifdef __cplusplus +/* the size of this enum is 1 byte; this is only relevant for C++ + code; the only C sources including this header don't use instances + of this enum, they only refer to the integer values */ +: uint8_t +#endif + { TAG_ARTIST, TAG_ARTIST_SORT, TAG_ALBUM, -- cgit v1.2.3