aboutsummaryrefslogtreecommitdiff
path: root/notmuch-search.c
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2015-09-03 22:39:57 +0300
committerDavid Bremner <david@tethera.net>2015-09-07 09:43:31 -0300
commitdfe15c0e1b18f4d9ab5d328399e56b3be4a251a5 (patch)
tree61b91d87294b81d346320f8dae7524b1575c3a3d /notmuch-search.c
parent1008fc45da0e206662694eacf12c0678ddcc6162 (diff)
cli: g_hash_table_lookup_extended is overkill
Switch to normal glib hash table lookup. The extended version is only required if the values may contain NULL.
Diffstat (limited to 'notmuch-search.c')
-rw-r--r--notmuch-search.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/notmuch-search.c b/notmuch-search.c
index 3076c3f6..7fdc6aca 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -248,7 +248,6 @@ do_search_threads (search_context_t *ctx)
static notmuch_bool_t
is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
{
- notmuch_bool_t duplicate;
char *key;
mailbox_t *mailbox;
@@ -256,20 +255,20 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
if (! key)
return FALSE;
- duplicate = g_hash_table_lookup_extended (ctx->addresses, key, NULL, (gpointer)&mailbox);
-
- if (! duplicate) {
- mailbox = talloc (ctx->format, mailbox_t);
- mailbox->name = talloc_strdup (mailbox, name);
- mailbox->addr = talloc_strdup (mailbox, addr);
- mailbox->count = 1;
- g_hash_table_insert (ctx->addresses, key, mailbox);
- } else {
+ mailbox = g_hash_table_lookup (ctx->addresses, key);
+ if (mailbox) {
mailbox->count++;
talloc_free (key);
+ return TRUE;
}
- return duplicate;
+ mailbox = talloc (ctx->format, mailbox_t);
+ mailbox->name = talloc_strdup (mailbox, name);
+ mailbox->addr = talloc_strdup (mailbox, addr);
+ mailbox->count = 1;
+ g_hash_table_insert (ctx->addresses, key, mailbox);
+
+ return FALSE;
}
static void