tag: convert ignore_tag_items to a bool array
This commit is contained in:
parent
6153c86bc3
commit
80571d1b5a
10
src/tag.c
10
src/tag.c
@ -62,7 +62,7 @@ const char *tag_item_names[TAG_NUM_OF_ITEM_TYPES] = {
|
|||||||
[TAG_MUSICBRAINZ_TRACKID] = "MUSICBRAINZ_TRACKID",
|
[TAG_MUSICBRAINZ_TRACKID] = "MUSICBRAINZ_TRACKID",
|
||||||
};
|
};
|
||||||
|
|
||||||
int8_t ignore_tag_items[TAG_NUM_OF_ITEM_TYPES];
|
bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES];
|
||||||
|
|
||||||
static size_t items_size(const struct tag *tag)
|
static size_t items_size(const struct tag *tag)
|
||||||
{
|
{
|
||||||
@ -80,14 +80,14 @@ void tag_lib_init(void)
|
|||||||
|
|
||||||
/* parse the "metadata_to_use" config parameter below */
|
/* parse the "metadata_to_use" config parameter below */
|
||||||
|
|
||||||
memset(ignore_tag_items, 0, TAG_NUM_OF_ITEM_TYPES);
|
/* ignore comments by default */
|
||||||
ignore_tag_items[TAG_ITEM_COMMENT] = 1; /* ignore comments by default */
|
ignore_tag_items[TAG_ITEM_COMMENT] = true;
|
||||||
|
|
||||||
value = config_get_string(CONF_METADATA_TO_USE, NULL);
|
value = config_get_string(CONF_METADATA_TO_USE, NULL);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(ignore_tag_items, 1, TAG_NUM_OF_ITEM_TYPES);
|
memset(ignore_tag_items, true, TAG_NUM_OF_ITEM_TYPES);
|
||||||
|
|
||||||
if (0 == strcasecmp(value, "none"))
|
if (0 == strcasecmp(value, "none"))
|
||||||
return;
|
return;
|
||||||
@ -100,7 +100,7 @@ void tag_lib_init(void)
|
|||||||
*s = '\0';
|
*s = '\0';
|
||||||
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
|
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
|
||||||
if (strcasecmp(c, tag_item_names[i]) == 0) {
|
if (strcasecmp(c, tag_item_names[i]) == 0) {
|
||||||
ignore_tag_items[i] = 0;
|
ignore_tag_items[i] = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#ifndef MPD_TAG_INTERNAL_H
|
#ifndef MPD_TAG_INTERNAL_H
|
||||||
#define MPD_TAG_INTERNAL_H
|
#define MPD_TAG_INTERNAL_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern int8_t ignore_tag_items[TAG_NUM_OF_ITEM_TYPES];
|
extern bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +27,7 @@ void tag_print_types(struct client *client)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
|
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
|
||||||
if (ignore_tag_items[i] == 0)
|
if (!ignore_tag_items[i])
|
||||||
client_printf(client, "tagtype: %s\n",
|
client_printf(client, "tagtype: %s\n",
|
||||||
tag_item_names[i]);
|
tag_item_names[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user