diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-05-02 12:16:03 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-05-02 12:16:03 -0700 |
commit | 51183f4ee7b78505af97bae9c28521cb6aed51b4 (patch) | |
tree | 678dc76f8a2875981218d3e8f6647a8e2d8c7f1f /dive.c | |
parent | 2894ee0759ba69551ecf2037f61baa4ce45cd39b (diff) | |
download | subsurface-51183f4ee7b78505af97bae9c28521cb6aed51b4.tar.gz |
Tag list handling: add two new helpers
taglist_added() simply figures out the tags that are in the new list but
not in the original list.
taglist_dump() makes debugging things easier.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -2642,7 +2642,29 @@ static bool taglist_contains_all(struct tag_entry *subtl, struct tag_entry *supe subtl = subtl->next; } return true; +} +struct tag_entry *taglist_added(struct tag_entry *original_list, struct tag_entry *new_list) +{ + struct tag_entry *added_list = NULL; + while (new_list) { + if (!taglist_contains(original_list, new_list->tag->name)) + taglist_add_tag(&added_list, new_list->tag->name); + new_list = new_list->next; + } + return added_list; +} + +void dump_taglist(const char *intro, struct tag_entry *tl) +{ + char *comma = ""; + fprintf(stderr, "%s", intro); + while(tl) { + fprintf(stderr, "%s %s", comma, tl->tag->name); + comma = ","; + tl = tl->next; + } + fprintf(stderr, "\n"); } // if tl1 is both a subset and superset of tl2 they must be the same |