X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Ftags.c;h=8fe4a3f0d4ebae5575f2e08abd5825781dbc1396;hp=afc132c50e17c2f41cb6f6709e3c6d827d237b95;hb=266ab595a2fcbc8467eae843557597835269a554;hpb=146549321044615d9aef2b30cedccda9c49f3f38 diff --git a/lib/tags.c b/lib/tags.c index afc132c5..8fe4a3f0 100644 --- a/lib/tags.c +++ b/lib/tags.c @@ -77,7 +77,8 @@ _notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag) * * The internal creator of 'tags' should call this function before * returning 'tags' to the user to call the public functions such as - * notmuch_tags_has_more, notmuch_tags_get, and notmuch_tags_advance. */ + * notmuch_tags_valid, notmuch_tags_get, and + * notmuch_tags_move_to_next. */ void _notmuch_tags_prepare_iterator (notmuch_tags_t *tags) { @@ -89,7 +90,7 @@ _notmuch_tags_prepare_iterator (notmuch_tags_t *tags) } notmuch_bool_t -notmuch_tags_has_more (notmuch_tags_t *tags) +notmuch_tags_valid (notmuch_tags_t *tags) { return tags->iterator != NULL; } @@ -97,15 +98,18 @@ notmuch_tags_has_more (notmuch_tags_t *tags) const char * notmuch_tags_get (notmuch_tags_t *tags) { - if (tags->iterator) - return (char *) tags->iterator->data; - else + if (tags->iterator == NULL) return NULL; + + return (char *) tags->iterator->data; } void -notmuch_tags_advance (notmuch_tags_t *tags) +notmuch_tags_move_to_next (notmuch_tags_t *tags) { + if (tags->iterator == NULL) + return; + tags->iterator = tags->iterator->next; }