diff options
author | Austin Clements <amdragon@mit.edu> | 2010-12-08 19:26:05 -0500 |
---|---|---|
committer | Austin Clements <amdragon@mit.edu> | 2011-03-21 02:45:18 -0400 |
commit | f3c1eebfaf8526129ae6946cbcd44a3c602563d6 (patch) | |
tree | 13457ad173997005f6023d274e9a0ec130bba098 /lib/database.cc | |
parent | d9b0ae918fd9d535e819b8859eca579002146661 (diff) |
Implement an internal generic string list and use it.
This replaces the guts of the filename list and tag list, making those
interfaces simple iterators over the generic string list. The
directory, message filename, and tags-related code now build generic
string lists and then wraps them in specific iterators. The real wins
come in later patches, when we use these for even more generic
functionality.
As a nice side-effect, this also eliminates the annoying dependency on
GList in the tag list.
Diffstat (limited to 'lib/database.cc')
-rw-r--r-- | lib/database.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/database.cc b/lib/database.cc index d88b168..9c77715 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1762,15 +1762,15 @@ _notmuch_convert_tags (void *ctx, Xapian::TermIterator &i, Xapian::TermIterator &end) { const char *prefix = _find_prefix ("tag"); - notmuch_tags_t *tags; + notmuch_string_list_t *list; std::string tag; /* Currently this iteration is written with the assumption that * "tag" has a single-character prefix. */ assert (strlen (prefix) == 1); - tags = _notmuch_tags_create (ctx); - if (unlikely (tags == NULL)) + list = _notmuch_string_list_create (ctx); + if (unlikely (list == NULL)) return NULL; i.skip_to (prefix); @@ -1781,14 +1781,14 @@ _notmuch_convert_tags (void *ctx, Xapian::TermIterator &i, if (tag.empty () || tag[0] != *prefix) break; - _notmuch_tags_add_tag (tags, tag.c_str () + 1); + _notmuch_string_list_append (list, tag.c_str () + 1); i++; } - _notmuch_tags_prepare_iterator (tags); + _notmuch_string_list_sort (list); - return tags; + return _notmuch_tags_create (ctx, list); } notmuch_tags_t * |