1 Return-Path: <amthrax@awakening.csail.mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 871B1431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 9 Dec 2010 13:00:30 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id qs2mtyM5j5os for <notmuch@notmuchmail.org>;
\r
16 Thu, 9 Dec 2010 13:00:28 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 917D3431FB5
\r
20 for <notmuch@notmuchmail.org>; Thu, 9 Dec 2010 13:00:28 -0800 (PST)
\r
21 X-AuditID: 12074422-b7c3eae000000a70-ea-4d01436cb68a
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-5.mit.edu (Symantec Brightmail Gateway) with
\r
24 SMTP id BC.D7.02672.C63410D4; Thu, 9 Dec 2010 16:00:28 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id oB9L0Sij011352;
\r
27 Thu, 9 Dec 2010 16:00:28 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id oB9L0QXa010074
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Thu, 9 Dec 2010 16:00:27 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)
\r
35 (envelope-from <amthrax@awakening.csail.mit.edu>)
\r
36 id 1PQnbG-0007Hp-SX; Thu, 09 Dec 2010 16:00:26 -0500
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH 2/5] Implement an internal generic string list and use it.
\r
40 Date: Thu, 9 Dec 2010 15:59:53 -0500
\r
41 Message-Id: <1291928396-27937-3-git-send-email-amdragon@mit.edu>
\r
42 X-Mailer: git-send-email 1.7.2.3
\r
43 In-Reply-To: <1291928396-27937-1-git-send-email-amdragon@mit.edu>
\r
44 References: <1291928396-27937-1-git-send-email-amdragon@mit.edu>
\r
46 Content-Type: text/plain; charset=UTF-8
\r
47 Content-Transfer-Encoding: 8bit
\r
48 X-Brightmail-Tracker: AAAAAhbjYfcW42MD
\r
49 Cc: Austin Clements <amdragon@mit.edu>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Thu, 09 Dec 2010 21:00:30 -0000
\r
64 This replaces the guts of the filename list and tag list, making those
\r
65 interfaces simple iterators over the generic string list. The
\r
66 directory, message filename, and tags-related code now build generic
\r
67 string lists and then wraps them in specific iterators. The real wins
\r
68 come in later patches, when we use these for even more generic
\r
71 As a nice side-effect, this also eliminates the annoying dependency on
\r
72 GList in the tag list.
\r
74 lib/Makefile.local | 1 +
\r
75 lib/database.cc | 12 +++---
\r
76 lib/directory.cc | 7 ++--
\r
77 lib/filenames.c | 52 +++------------------------
\r
78 lib/message.cc | 15 ++++----
\r
79 lib/messages.c | 11 +++---
\r
80 lib/notmuch-private.h | 68 +++++++++++++++++++++--------------
\r
81 lib/strings.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++
\r
82 lib/tags.c | 63 ++++++--------------------------
\r
83 lib/thread.cc | 10 +++---
\r
84 10 files changed, 179 insertions(+), 154 deletions(-)
\r
85 create mode 100644 lib/strings.c
\r
87 diff --git a/lib/Makefile.local b/lib/Makefile.local
\r
88 index 5233ea6..37d1c0d 100644
\r
89 --- a/lib/Makefile.local
\r
90 +++ b/lib/Makefile.local
\r
91 @@ -50,6 +50,7 @@ extra_cflags += -I$(dir) -fPIC
\r
92 libnotmuch_c_srcs = \
\r
93 $(notmuch_compat_srcs) \
\r
94 $(dir)/filenames.c \
\r
95 + $(dir)/strings.c \
\r
97 $(dir)/message-file.c \
\r
99 diff --git a/lib/database.cc b/lib/database.cc
\r
100 index 7a00917..45613bd 100644
\r
101 --- a/lib/database.cc
\r
102 +++ b/lib/database.cc
\r
103 @@ -1752,15 +1752,15 @@ _notmuch_convert_tags (void *ctx, Xapian::TermIterator &i,
\r
104 Xapian::TermIterator &end)
\r
106 const char *prefix = _find_prefix ("tag");
\r
107 - notmuch_tags_t *tags;
\r
108 + notmuch_string_list_t *list;
\r
111 /* Currently this iteration is written with the assumption that
\r
112 * "tag" has a single-character prefix. */
\r
113 assert (strlen (prefix) == 1);
\r
115 - tags = _notmuch_tags_create (ctx);
\r
116 - if (unlikely (tags == NULL))
\r
117 + list = _notmuch_string_list_create (ctx);
\r
118 + if (unlikely (list == NULL))
\r
121 i.skip_to (prefix);
\r
122 @@ -1771,14 +1771,14 @@ _notmuch_convert_tags (void *ctx, Xapian::TermIterator &i,
\r
123 if (tag.empty () || tag[0] != *prefix)
\r
126 - _notmuch_tags_add_tag (tags, tag.c_str () + 1);
\r
127 + _notmuch_string_list_append (list, tag.c_str () + 1);
\r
132 - _notmuch_tags_prepare_iterator (tags);
\r
133 + _notmuch_string_list_sort (list);
\r
136 + return _notmuch_tags_create (ctx, list, TRUE);
\r
140 diff --git a/lib/directory.cc b/lib/directory.cc
\r
141 index 946be4f..aeee9ca 100644
\r
142 --- a/lib/directory.cc
\r
143 +++ b/lib/directory.cc
\r
144 @@ -33,11 +33,11 @@ _create_filenames_for_terms_with_prefix (void *ctx,
\r
145 notmuch_database_t *notmuch,
\r
146 const char *prefix)
\r
148 - notmuch_filename_list_t *filename_list;
\r
149 + notmuch_string_list_t *filename_list;
\r
150 Xapian::TermIterator i, end;
\r
151 int prefix_len = strlen (prefix);
\r
153 - filename_list = _notmuch_filename_list_create (ctx);
\r
154 + filename_list = _notmuch_string_list_create (ctx);
\r
155 if (unlikely (filename_list == NULL))
\r
158 @@ -47,8 +47,7 @@ _create_filenames_for_terms_with_prefix (void *ctx,
\r
160 std::string term = *i;
\r
162 - _notmuch_filename_list_add_filename (filename_list, term.c_str () +
\r
164 + _notmuch_string_list_append (filename_list, term.c_str () + prefix_len);
\r
167 return _notmuch_filenames_create (ctx, filename_list);
\r
168 diff --git a/lib/filenames.c b/lib/filenames.c
\r
169 index f078c95..f1ea243 100644
\r
170 --- a/lib/filenames.c
\r
171 +++ b/lib/filenames.c
\r
172 @@ -21,56 +21,14 @@
\r
173 #include "notmuch-private.h"
\r
175 struct _notmuch_filenames {
\r
176 - notmuch_filename_node_t *iterator;
\r
177 + notmuch_string_node_t *iterator;
\r
180 -/* Create a new notmuch_filename_list_t object, with 'ctx' as its
\r
183 - * This function can return NULL in case of out-of-memory.
\r
185 -notmuch_filename_list_t *
\r
186 -_notmuch_filename_list_create (const void *ctx)
\r
188 - notmuch_filename_list_t *list;
\r
190 - list = talloc (ctx, notmuch_filename_list_t);
\r
191 - if (unlikely (list == NULL))
\r
194 - list->head = NULL;
\r
195 - list->tail = &list->head;
\r
201 -_notmuch_filename_list_add_filename (notmuch_filename_list_t *list,
\r
202 - const char *filename)
\r
204 - /* Create and initialize new node. */
\r
205 - notmuch_filename_node_t *node = talloc (list,
\r
206 - notmuch_filename_node_t);
\r
208 - node->filename = talloc_strdup (node, filename);
\r
209 - node->next = NULL;
\r
211 - /* Append the node to the list. */
\r
212 - *(list->tail) = node;
\r
213 - list->tail = &node->next;
\r
217 -_notmuch_filename_list_destroy (notmuch_filename_list_t *list)
\r
219 - talloc_free (list);
\r
222 -/* The notmuch_filenames_t is an iterator object for a
\r
223 - * notmuch_filename_list_t */
\r
224 +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of
\r
226 notmuch_filenames_t *
\r
227 _notmuch_filenames_create (const void *ctx,
\r
228 - notmuch_filename_list_t *list)
\r
229 + notmuch_string_list_t *list)
\r
231 notmuch_filenames_t *filenames;
\r
233 @@ -99,7 +57,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
\r
234 if (filenames->iterator == NULL)
\r
237 - return filenames->iterator->filename;
\r
238 + return filenames->iterator->string;
\r
242 diff --git a/lib/message.cc b/lib/message.cc
\r
243 index d6ab636..031eda5 100644
\r
244 --- a/lib/message.cc
\r
245 +++ b/lib/message.cc
\r
246 @@ -32,7 +32,7 @@ struct _notmuch_message {
\r
250 - notmuch_filename_list_t *filename_list;
\r
251 + notmuch_string_list_t *filename_list;
\r
253 notmuch_message_file_t *message_file;
\r
254 notmuch_message_list_t *replies;
\r
255 @@ -434,7 +434,7 @@ _notmuch_message_add_filename (notmuch_message_t *message,
\r
258 if (message->filename_list) {
\r
259 - _notmuch_filename_list_destroy (message->filename_list);
\r
260 + talloc_free (message->filename_list);
\r
261 message->filename_list = NULL;
\r
264 @@ -511,7 +511,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message)
\r
265 if (message->filename_list)
\r
268 - message->filename_list = _notmuch_filename_list_create (message);
\r
269 + message->filename_list = _notmuch_string_list_create (message);
\r
271 i = message->doc.termlist_begin ();
\r
272 i.skip_to (prefix);
\r
273 @@ -532,7 +532,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message)
\r
275 INTERNAL_ERROR ("message with no filename");
\r
277 - _notmuch_filename_list_add_filename (message->filename_list, data);
\r
278 + _notmuch_string_list_append (message->filename_list, data);
\r
282 @@ -573,8 +573,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message)
\r
283 filename = talloc_asprintf (message, "%s/%s",
\r
284 db_path, basename);
\r
286 - _notmuch_filename_list_add_filename (message->filename_list,
\r
288 + _notmuch_string_list_append (message->filename_list, filename);
\r
290 talloc_free (local);
\r
292 @@ -589,12 +588,12 @@ notmuch_message_get_filename (notmuch_message_t *message)
\r
295 if (message->filename_list->head == NULL ||
\r
296 - message->filename_list->head->filename == NULL)
\r
297 + message->filename_list->head->string == NULL)
\r
299 INTERNAL_ERROR ("message with no filename");
\r
302 - return message->filename_list->head->filename;
\r
303 + return message->filename_list->head->string;
\r
306 notmuch_filenames_t *
\r
307 diff --git a/lib/messages.c b/lib/messages.c
\r
308 index 120a48a..404e8b3 100644
\r
309 --- a/lib/messages.c
\r
310 +++ b/lib/messages.c
\r
311 @@ -146,13 +146,14 @@ notmuch_messages_destroy (notmuch_messages_t *messages)
\r
313 notmuch_messages_collect_tags (notmuch_messages_t *messages)
\r
315 - notmuch_tags_t *tags, *msg_tags;
\r
316 + notmuch_string_list_t *tags;
\r
317 + notmuch_tags_t *msg_tags;
\r
318 notmuch_message_t *msg;
\r
319 GHashTable *htable;
\r
323 - tags = _notmuch_tags_create (messages);
\r
324 + tags = _notmuch_string_list_create (messages);
\r
325 if (tags == NULL) return NULL;
\r
327 htable = g_hash_table_new_full (g_str_hash, g_str_equal, free, NULL);
\r
328 @@ -170,12 +171,12 @@ notmuch_messages_collect_tags (notmuch_messages_t *messages)
\r
330 keys = g_hash_table_get_keys (htable);
\r
331 for (l = keys; l; l = l->next) {
\r
332 - _notmuch_tags_add_tag (tags, (char *)l->data);
\r
333 + _notmuch_string_list_append (tags, (char *)l->data);
\r
336 g_list_free (keys);
\r
337 g_hash_table_destroy (htable);
\r
339 - _notmuch_tags_prepare_iterator (tags);
\r
341 + _notmuch_string_list_sort (tags);
\r
342 + return _notmuch_tags_create (messages, tags, TRUE);
\r
344 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
345 index 303aeb3..b6f1095 100644
\r
346 --- a/lib/notmuch-private.h
\r
347 +++ b/lib/notmuch-private.h
\r
348 @@ -453,48 +453,60 @@ notmuch_sha1_of_string (const char *str);
\r
350 notmuch_sha1_of_file (const char *filename);
\r
356 -_notmuch_tags_create (void *ctx);
\r
357 +typedef struct _notmuch_string_node {
\r
359 + struct _notmuch_string_node *next;
\r
360 +} notmuch_string_node_t;
\r
362 +typedef struct _notmuch_string_list {
\r
364 + notmuch_string_node_t *head;
\r
365 + notmuch_string_node_t **tail;
\r
366 +} notmuch_string_list_t;
\r
368 +notmuch_string_list_t *
\r
369 +_notmuch_string_list_create (const void *ctx);
\r
371 +/* Add 'string' to 'list'.
\r
373 + * The list will create its own talloced copy of 'string'.
\r
376 -_notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag);
\r
377 +_notmuch_string_list_append (notmuch_string_list_t *list,
\r
378 + const char *string);
\r
381 -_notmuch_tags_prepare_iterator (notmuch_tags_t *tags);
\r
382 +_notmuch_string_list_sort (notmuch_string_list_t *list);
\r
388 +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,
\r
389 + notmuch_bool_t steal);
\r
391 -typedef struct _notmuch_filename_node {
\r
393 - struct _notmuch_filename_node *next;
\r
394 -} notmuch_filename_node_t;
\r
397 -typedef struct _notmuch_filename_list {
\r
398 - notmuch_filename_node_t *head;
\r
399 - notmuch_filename_node_t **tail;
\r
400 -} notmuch_filename_list_t;
\r
401 +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of
\r
403 +notmuch_filenames_t *
\r
404 +_notmuch_filenames_create (const void *ctx,
\r
405 + notmuch_string_list_t *list);
\r
407 -notmuch_filename_list_t *
\r
408 -_notmuch_filename_list_create (const void *ctx);
\r
411 -/* Add 'filename' to 'list'.
\r
413 - * The list will create its own talloced copy of 'filename'.
\r
416 -_notmuch_filename_list_add_filename (notmuch_filename_list_t *list,
\r
417 - const char *filename);
\r
419 +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,
\r
420 + notmuch_bool_t steal);
\r
423 -_notmuch_filename_list_destroy (notmuch_filename_list_t *list);
\r
426 -/* The notmuch_filenames_t is an iterator object for a
\r
427 - * notmuch_filename_list_t */
\r
428 +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of
\r
430 notmuch_filenames_t *
\r
431 _notmuch_filenames_create (const void *ctx,
\r
432 - notmuch_filename_list_t *list);
\r
433 + notmuch_string_list_t *list);
\r
435 #pragma GCC visibility pop
\r
437 diff --git a/lib/strings.c b/lib/strings.c
\r
438 new file mode 100644
\r
439 index 0000000..d92a0ba
\r
441 +++ b/lib/strings.c
\r
443 +/* strings.c - Iterator for a list of strings
\r
445 + * Copyright © 2010 Intel Corporation
\r
447 + * This program is free software: you can redistribute it and/or modify
\r
448 + * it under the terms of the GNU General Public License as published by
\r
449 + * the Free Software Foundation, either version 3 of the License, or
\r
450 + * (at your option) any later version.
\r
452 + * This program is distributed in the hope that it will be useful,
\r
453 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
454 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
455 + * GNU General Public License for more details.
\r
457 + * You should have received a copy of the GNU General Public License
\r
458 + * along with this program. If not, see http://www.gnu.org/licenses/ .
\r
460 + * Author: Carl Worth <cworth@cworth.org>
\r
463 +#include "notmuch-private.h"
\r
465 +/* Create a new notmuch_string_list_t object, with 'ctx' as its
\r
468 + * This function can return NULL in case of out-of-memory.
\r
470 +notmuch_string_list_t *
\r
471 +_notmuch_string_list_create (const void *ctx)
\r
473 + notmuch_string_list_t *list;
\r
475 + list = talloc (ctx, notmuch_string_list_t);
\r
476 + if (unlikely (list == NULL))
\r
479 + list->length = 0;
\r
480 + list->head = NULL;
\r
481 + list->tail = &list->head;
\r
487 +_notmuch_string_list_append (notmuch_string_list_t *list,
\r
488 + const char *string)
\r
490 + /* Create and initialize new node. */
\r
491 + notmuch_string_node_t *node = talloc (list, notmuch_string_node_t);
\r
493 + node->string = talloc_strdup (node, string);
\r
494 + node->next = NULL;
\r
496 + /* Append the node to the list. */
\r
497 + *(list->tail) = node;
\r
498 + list->tail = &node->next;
\r
503 +cmpnode (const void *pa, const void *pb)
\r
505 + notmuch_string_node_t *a = *(notmuch_string_node_t * const *)pa;
\r
506 + notmuch_string_node_t *b = *(notmuch_string_node_t * const *)pb;
\r
508 + return strcmp (a->string, b->string);
\r
512 +_notmuch_string_list_sort (notmuch_string_list_t *list)
\r
514 + notmuch_string_node_t **nodes, *node;
\r
517 + if (list->length == 0)
\r
520 + nodes = talloc_array (list, notmuch_string_node_t *, list->length);
\r
521 + if (unlikely (nodes == NULL))
\r
522 + INTERNAL_ERROR ("Could not allocate memory for list sort");
\r
524 + for (i = 0, node = list->head; node; i++, node = node->next)
\r
527 + qsort (nodes, list->length, sizeof (*nodes), cmpnode);
\r
529 + for (i = 0; i < list->length - 1; ++i)
\r
530 + nodes[i]->next = nodes[i+1];
\r
531 + nodes[i]->next = NULL;
\r
532 + list->head = nodes[0];
\r
533 + list->tail = &nodes[i]->next;
\r
535 + talloc_free (nodes);
\r
537 diff --git a/lib/tags.c b/lib/tags.c
\r
538 index 8fe4a3f..8392ef6 100644
\r
541 @@ -20,30 +20,20 @@
\r
543 #include "notmuch-private.h"
\r
545 -#include <glib.h> /* GList */
\r
547 struct _notmuch_tags {
\r
551 + notmuch_string_node_t *iterator;
\r
554 -/* XXX: Should write some talloc-friendly list to avoid the need for
\r
557 -_notmuch_tags_destructor (notmuch_tags_t *tags)
\r
559 - g_list_free (tags->tags);
\r
564 /* Create a new notmuch_tags_t object, with 'ctx' as its talloc owner.
\r
565 + * If steal is true, then the iterator will steal the reference to the
\r
566 + * list (useful for one-shot iterators); otherwise it will add a
\r
569 * This function can return NULL in case of out-of-memory.
\r
572 -_notmuch_tags_create (void *ctx)
\r
573 +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,
\r
574 + notmuch_bool_t steal)
\r
576 notmuch_tags_t *tags;
\r
578 @@ -51,44 +41,15 @@ _notmuch_tags_create (void *ctx)
\r
579 if (unlikely (tags == NULL))
\r
582 - talloc_set_destructor (tags, _notmuch_tags_destructor);
\r
584 - tags->sorted = 1;
\r
585 - tags->tags = NULL;
\r
586 - tags->iterator = NULL;
\r
587 + tags->iterator = list->head;
\r
589 + talloc_steal (tags, list);
\r
591 + (void) talloc_reference (tags, list);
\r
596 -/* Add a new tag to 'tags'. The tags object will create its own copy
\r
599 - * Note: The tags object will not do anything to prevent duplicate
\r
600 - * tags being stored, so the caller really shouldn't pass
\r
603 -_notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag)
\r
605 - tags->tags = g_list_prepend (tags->tags, talloc_strdup (tags, tag));
\r
606 - tags->sorted = 0;
\r
609 -/* Prepare 'tag' for iteration.
\r
611 - * The internal creator of 'tags' should call this function before
\r
612 - * returning 'tags' to the user to call the public functions such as
\r
613 - * notmuch_tags_valid, notmuch_tags_get, and
\r
614 - * notmuch_tags_move_to_next. */
\r
616 -_notmuch_tags_prepare_iterator (notmuch_tags_t *tags)
\r
618 - if (! tags->sorted)
\r
619 - tags->tags = g_list_sort (tags->tags, (GCompareFunc) strcmp);
\r
620 - tags->sorted = 1;
\r
622 - tags->iterator = tags->tags;
\r
626 notmuch_tags_valid (notmuch_tags_t *tags)
\r
628 @@ -101,7 +62,7 @@ notmuch_tags_get (notmuch_tags_t *tags)
\r
629 if (tags->iterator == NULL)
\r
632 - return (char *) tags->iterator->data;
\r
633 + return (char *) tags->iterator->string;
\r
637 diff --git a/lib/thread.cc b/lib/thread.cc
\r
638 index b29f2c9..5b024fd 100644
\r
639 --- a/lib/thread.cc
\r
640 +++ b/lib/thread.cc
\r
641 @@ -535,23 +535,23 @@ notmuch_thread_get_newest_date (notmuch_thread_t *thread)
\r
643 notmuch_thread_get_tags (notmuch_thread_t *thread)
\r
645 - notmuch_tags_t *tags;
\r
646 + notmuch_string_list_t *tags;
\r
649 - tags = _notmuch_tags_create (thread);
\r
650 + tags = _notmuch_string_list_create (thread);
\r
651 if (unlikely (tags == NULL))
\r
654 keys = g_hash_table_get_keys (thread->tags);
\r
656 for (l = keys; l; l = l->next)
\r
657 - _notmuch_tags_add_tag (tags, (char *) l->data);
\r
658 + _notmuch_string_list_append (tags, (char *) l->data);
\r
660 g_list_free (keys);
\r
662 - _notmuch_tags_prepare_iterator (tags);
\r
663 + _notmuch_string_list_sort (tags);
\r
666 + return _notmuch_tags_create (thread, tags, true);
\r