From bfd48c4c83d34d667648f31c8edf034f5f88f2ae Mon Sep 17 00:00:00 2001 From: Nev3r Date: Sun, 12 Apr 2020 13:05:21 +0200 Subject: [PATCH] add Tag_Compare() --- src/taglist.c | 14 ++++++++++++++ src/taglist.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/taglist.c b/src/taglist.c index 9090d4e0b..ceaebf9aa 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -6,3 +6,17 @@ void Tag_Add (taglist_t* list, const UINT16 tag) list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(list->tags), PU_LEVEL, NULL); list->tags[list->count++] = tag; } + +boolean Tag_Compare (const taglist_t* list1, const taglist_t* list2) +{ + size_t i; + + if (list1->count != list2->count) + return false; + + for (i = 0; i < list1->count; i++) + if (list1->tags[i] != list2->tags[i]) + return false; + + return true; +} diff --git a/src/taglist.h b/src/taglist.h index 744918d7c..62fac0d82 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -11,4 +11,5 @@ typedef struct } taglist_t; void Tag_Add (taglist_t* list, const UINT16 tag); +boolean Tag_Compare (const taglist_t* list1, const taglist_t* list2); #endif //__R_TAGLIST__