diff options
author | Max Kellermann <max@duempel.org> | 2008-11-03 18:24:00 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-03 18:24:00 +0100 |
commit | 8bb2da063f59e7586c61f88c1fb2d268e6191e5c (patch) | |
tree | c992c72e96fadc9400bc416b765c23f320b1f138 /src/tag.c | |
parent | b9d456a041a3cc11e8bb7e6a9500e2c5f2fa4ee2 (diff) |
tag: added function tag_has_type()
tag_has_type() checks whether the tag contains one or more items with
the specified type.
Diffstat (limited to 'src/tag.c')
-rw-r--r-- | src/tag.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -319,6 +319,18 @@ struct tag *tag_dup(const struct tag *tag) return ret; } +bool tag_has_type(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 false; +} + int tag_equal(const struct tag *tag1, const struct tag *tag2) { int i; |