aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-24 10:52:08 +0200
committerMax Kellermann <max@duempel.org>2015-08-24 11:20:45 +0200
commit60c077c79076f50317a4637b65c69bff3df134a7 (patch)
treeb40d1b0a7951b27a87eed3dcdc861127ea3662b2 /src/tag
parent7aaa4dda2261f416478a9987ce25b46929c60957 (diff)
downloadmpd-60c077c79076f50317a4637b65c69bff3df134a7.tar.gz
mpd-60c077c79076f50317a4637b65c69bff3df134a7.tar.xz
mpd-60c077c79076f50317a4637b65c69bff3df134a7.zip
tag/Settings: add function IsTagEnabled() wrapping access to ignore_tag_items[]
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/Set.cxx2
-rw-r--r--src/tag/TagBuilder.cxx2
-rw-r--r--src/tag/TagSettings.h19
3 files changed, 21 insertions, 2 deletions
diff --git a/src/tag/Set.cxx b/src/tag/Set.cxx
index 22d1728ad..24ca30ee3 100644
--- a/src/tag/Set.cxx
+++ b/src/tag/Set.cxx
@@ -110,7 +110,7 @@ TagSet::InsertUnique(const Tag &tag,
if (!CheckUnique(type, tag, type, group_mask) &&
(type != TAG_ALBUM_ARTIST ||
- ignore_tag_items[TAG_ALBUM_ARTIST] ||
+ !IsTagEnabled(TAG_ALBUM_ARTIST) ||
/* fall back to "Artist" if no "AlbumArtist" was found */
!CheckUnique(type, tag, TAG_ARTIST, group_mask)))
InsertUnique(tag, type, nullptr, group_mask);
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx
index 42e11e798..4e810475f 100644
--- a/src/tag/TagBuilder.cxx
+++ b/src/tag/TagBuilder.cxx
@@ -220,7 +220,7 @@ TagBuilder::AddItem(TagType type, const char *value, size_t length)
assert(value != nullptr);
#endif
- if (length == 0 || ignore_tag_items[type])
+ if (length == 0 || !IsTagEnabled(type))
return;
AddItemInternal(type, value, length);
diff --git a/src/tag/TagSettings.h b/src/tag/TagSettings.h
index cf91b52e1..a58bd8915 100644
--- a/src/tag/TagSettings.h
+++ b/src/tag/TagSettings.h
@@ -21,9 +21,28 @@
#define MPD_TAG_SETTINGS_H
#include "TagType.h"
+#include "Compiler.h"
#include <stdbool.h>
extern bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES];
+#ifdef __cplusplus
+
+gcc_const
+static inline bool
+IsTagEnabled(unsigned tag)
+{
+ return !ignore_tag_items[tag];
+}
+
+gcc_const
+static inline bool
+IsTagEnabled(TagType tag)
+{
+ return IsTagEnabled(unsigned(tag));
+}
+
+#endif
+
#endif