tag_table: convert to a struct

The struct is smaller because it is sparse.  Its traversal is also
more efficient.
This commit is contained in:
Max Kellermann
2012-02-11 10:34:21 +01:00
parent 6e05071a47
commit 767ade02f4
3 changed files with 22 additions and 14 deletions

View File

@@ -23,15 +23,16 @@
#include "tag_table.h"
#include "ape.h"
static const char *const ape_tag_names[TAG_NUM_OF_ITEM_TYPES] = {
[TAG_ALBUM_ARTIST] = "album artist",
[TAG_DATE] = "year",
static const struct tag_table ape_tags[] = {
{ "album artist", TAG_ALBUM_ARTIST },
{ "year", TAG_DATE },
{ NULL, TAG_NUM_OF_ITEM_TYPES }
};
static enum tag_type
tag_ape_name_parse(const char *name)
{
enum tag_type type = tag_table_lookup(ape_tag_names, name);
enum tag_type type = tag_table_lookup_i(ape_tags, name);
if (type == TAG_NUM_OF_ITEM_TYPES)
type = tag_name_parse_i(name);