aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-15 00:21:08 +0100
committerMax Kellermann <max@duempel.org>2009-01-15 00:21:08 +0100
commit2fad5783762c2f2868c8b5239835d54de23912d3 (patch)
tree898dee0f0e59bf42d9050c68aa1883272ff58644 /src/tag.c
parent4847bbaad372c7c51811bafe2fdf3ffbf28d9a69 (diff)
downloadmpd-2fad5783762c2f2868c8b5239835d54de23912d3.tar.gz
mpd-2fad5783762c2f2868c8b5239835d54de23912d3.tar.xz
mpd-2fad5783762c2f2868c8b5239835d54de23912d3.zip
tag: added tag_get_value()
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tag.c b/src/tag.c
index 285afe84c..edef3aedd 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -365,16 +365,22 @@ tag_merge(const struct tag *base, const struct tag *add)
return ret;
}
-bool tag_has_type(const struct tag *tag, enum tag_type type)
+const char *
+tag_get_value(const struct tag *tag, enum tag_type type)
{
assert(tag != NULL);
assert(type < TAG_NUM_OF_ITEM_TYPES);
for (unsigned i = 0; i < tag->numOfItems; i++)
if (tag->items[i]->type == type)
- return true;
+ return tag->items[i]->value;
+
+ return NULL;
+}
- return false;
+bool tag_has_type(const struct tag *tag, enum tag_type type)
+{
+ return tag_get_value(tag, type) != NULL;
}
int tag_equal(const struct tag *tag1, const struct tag *tag2)