1 Return-Path: <jani@nikula.org>
\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 arlo.cworth.org (Postfix) with ESMTP id 4D82B6DE00CB
\r
6 for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:45 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
10 X-Spam-Score: -0.319
\r
12 X-Spam-Status: No, score=-0.319 tagged_above=-999 required=5 tests=[AWL=0.401,
\r
13 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]
\r
15 Received: from arlo.cworth.org ([127.0.0.1])
\r
16 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id 4Igz_n-P_MNA for <notmuch@notmuchmail.org>;
\r
18 Sat, 29 Aug 2015 07:56:43 -0700 (PDT)
\r
19 Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id 3415A6DE1422
\r
22 for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:43 -0700 (PDT)
\r
23 Received: by widfa3 with SMTP id fa3so579924wid.1
\r
24 for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:41 -0700 (PDT)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 :references:in-reply-to:references;
\r
29 bh=oOK9FwQQJYfJ8EEw/WSzOC9eP/5F8JfiWJh6LE9dUxo=;
\r
30 b=ErH4jZ5YJKr1e3j2xzo7W8a8/aK/0/2Cj6TTOaZqwgGPIjZc6huE/oKcB5U/D/Oo98
\r
31 OistkQaVMYU8a2ZRGhcZWugtv8IltNWrJehRwj8TYyLPhxhxHY1lQdFQXibMXUrGiaAZ
\r
32 romS21xTudrauzb15IM9s8noFcw8m0d1rPgMLDxt56+v2oZDO9yxMXKeOhQiH0Ro+BMG
\r
33 vbfkBfMIIU7/uVNbXghu2SP6YxMOZ8qsZgW8Vth5218miytk2Ko1izuKRZ9nD4E8jbaQ
\r
34 ZWLWhxnfhGCl5FmZYEJWUM+s4vzwdpNrVThpRQamLvscyP3Fu5alOs65deshvj1eh4nc
\r
37 ALoCoQkOkWrx8zB+YnHG3hz82FOFMKysDXJ2EPI2oiGXRNKkBan1pn2BuCpeEg8ke3nLWw902Y5R
\r
38 X-Received: by 10.180.186.41 with SMTP id fh9mr10190716wic.7.1440860201723;
\r
39 Sat, 29 Aug 2015 07:56:41 -0700 (PDT)
\r
40 Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.
\r
42 by smtp.gmail.com with ESMTPSA id kb1sm13165728wjc.24.2015.08.29.07.56.40
\r
43 (version=TLSv1/SSLv3 cipher=OTHER);
\r
44 Sat, 29 Aug 2015 07:56:41 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org
\r
47 Subject: [RFC PATCH 1/5] cli: g_hash_table_lookup_extended is overkill
\r
48 Date: Sat, 29 Aug 2015 17:56:32 +0300
\r
50 <4e640f9d373e9c07129e6f1f0ddbe4d1bb4febd9.1440859765.git.jani@nikula.org>
\r
51 X-Mailer: git-send-email 2.1.4
\r
52 In-Reply-To: <cover.1440859765.git.jani@nikula.org>
\r
53 References: <cover.1440859765.git.jani@nikula.org>
\r
54 In-Reply-To: <cover.1440859765.git.jani@nikula.org>
\r
55 References: <cover.1440859765.git.jani@nikula.org>
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.18
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Sat, 29 Aug 2015 14:56:45 -0000
\r
70 Switch to normal glib hash table lookup. The extended version is only
\r
71 required if the values may contain NULL.
\r
73 notmuch-search.c | 21 ++++++++++-----------
\r
74 1 file changed, 10 insertions(+), 11 deletions(-)
\r
76 diff --git a/notmuch-search.c b/notmuch-search.c
\r
77 index 3076c3f637b1..7fdc6acaa2fe 100644
\r
78 --- a/notmuch-search.c
\r
79 +++ b/notmuch-search.c
\r
80 @@ -248,7 +248,6 @@ do_search_threads (search_context_t *ctx)
\r
81 static notmuch_bool_t
\r
82 is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
\r
84 - notmuch_bool_t duplicate;
\r
88 @@ -256,20 +255,20 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
\r
92 - duplicate = g_hash_table_lookup_extended (ctx->addresses, key, NULL, (gpointer)&mailbox);
\r
94 - if (! duplicate) {
\r
95 - mailbox = talloc (ctx->format, mailbox_t);
\r
96 - mailbox->name = talloc_strdup (mailbox, name);
\r
97 - mailbox->addr = talloc_strdup (mailbox, addr);
\r
98 - mailbox->count = 1;
\r
99 - g_hash_table_insert (ctx->addresses, key, mailbox);
\r
101 + mailbox = g_hash_table_lookup (ctx->addresses, key);
\r
108 - return duplicate;
\r
109 + mailbox = talloc (ctx->format, mailbox_t);
\r
110 + mailbox->name = talloc_strdup (mailbox, name);
\r
111 + mailbox->addr = talloc_strdup (mailbox, addr);
\r
112 + mailbox->count = 1;
\r
113 + g_hash_table_insert (ctx->addresses, key, mailbox);
\r