mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
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.
This commit is contained in:
parent
1008fc45da
commit
dfe15c0e1b
1 changed files with 10 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue