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 0D0A26DE17BF
\r
6 for <notmuch@notmuchmail.org>; Thu, 3 Sep 2015 12:40:28 -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.416
\r
12 X-Spam-Status: No, score=-0.416 tagged_above=-999 required=5 tests=[AWL=0.304,
\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 EoiBePqI9XWk for <notmuch@notmuchmail.org>;
\r
18 Thu, 3 Sep 2015 12:40:26 -0700 (PDT)
\r
19 Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id D04F26DE1534
\r
22 for <notmuch@notmuchmail.org>; Thu, 3 Sep 2015 12:40:15 -0700 (PDT)
\r
23 Received: by wiclk2 with SMTP id lk2so19111569wic.1
\r
24 for <notmuch@notmuchmail.org>; Thu, 03 Sep 2015 12:40:13 -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=7x21swL2LRVephKeotLrwmieDqRaO00TDhQTFy28Q6k=;
\r
30 b=I5x4/Le4CQ9ij/EGute5b4TnQejQDVWowVLSBg8tooKl7i8AQzWvPa7388qDT4qxUt
\r
31 7gqhogx3SJBPY3/plgf+HuFw350Wm2weEHhD68LXLQKZHoF9rpszL7iUgwPfShBo9+to
\r
32 F4BmBZ0c0fJdoDSsaG8Jt1gJpNzOXN2upHF4ZQz5xTlJkZTMlw8IJaFCNsY2iAiLb43Q
\r
33 RuTCjtWihBrR6ln6KHcukkj0LmCb0oHN29pPjV36ghiKcJIH/2O3kcPBRrt27OuHLsxi
\r
34 ojKEMrYAW8iHNP+rDvROz3g4nv0wbgDV0Q6ZWiMpenroqtPMpDrTYawX19yrXInuGtPR
\r
37 ALoCoQkGyD9dt5hpwztHMVu/LAAJNdM8QVZLoj5UsCu4lYGGVU+2dTsrA6ROiRwotIvIaXa0Lbeq
\r
38 X-Received: by 10.180.104.68 with SMTP id gc4mr18128958wib.67.1441309212975;
\r
39 Thu, 03 Sep 2015 12:40:12 -0700 (PDT)
\r
40 Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.
\r
42 by smtp.gmail.com with ESMTPSA id c11sm114253wib.1.2015.09.03.12.40.12
\r
43 (version=TLSv1/SSLv3 cipher=OTHER);
\r
44 Thu, 03 Sep 2015 12:40:12 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org
\r
47 Subject: [PATCH v2 2/9] cli: abstract new mailbox creation
\r
48 Date: Thu, 3 Sep 2015 22:39:58 +0300
\r
50 <cf56a57d13ea2ae8f3115d602a640a11a2b7e5a0.1441308761.git.jani@nikula.org>
\r
51 X-Mailer: git-send-email 2.1.4
\r
52 In-Reply-To: <cover.1441308761.git.jani@nikula.org>
\r
53 References: <cover.1441308761.git.jani@nikula.org>
\r
54 In-Reply-To: <cover.1441308761.git.jani@nikula.org>
\r
55 References: <cover.1441308761.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: Thu, 03 Sep 2015 19:40:28 -0000
\r
70 We'll be needing more mailbox creation soon, so abstract it
\r
71 away. While at it, check for allocation failures. No other functional
\r
74 notmuch-search.c | 23 +++++++++++++++++++----
\r
75 1 file changed, 19 insertions(+), 4 deletions(-)
\r
77 diff --git a/notmuch-search.c b/notmuch-search.c
\r
78 index 7fdc6acaa2fe..36f58eb8d54c 100644
\r
79 --- a/notmuch-search.c
\r
80 +++ b/notmuch-search.c
\r
81 @@ -243,6 +243,21 @@ do_search_threads (search_context_t *ctx)
\r
85 +static mailbox_t *new_mailbox (void *ctx, const char *name, const char *addr)
\r
87 + mailbox_t *mailbox;
\r
89 + mailbox = talloc (ctx, mailbox_t);
\r
93 + mailbox->name = talloc_strdup (mailbox, name);
\r
94 + mailbox->addr = talloc_strdup (mailbox, addr);
\r
95 + mailbox->count = 1;
\r
100 /* Returns TRUE iff name and addr is duplicate. If not, stores the
\r
101 * name/addr pair in order to detect subsequent duplicates. */
\r
102 static notmuch_bool_t
\r
103 @@ -262,10 +277,10 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
\r
107 - mailbox = talloc (ctx->format, mailbox_t);
\r
108 - mailbox->name = talloc_strdup (mailbox, name);
\r
109 - mailbox->addr = talloc_strdup (mailbox, addr);
\r
110 - mailbox->count = 1;
\r
111 + mailbox = new_mailbox (ctx->format, name, addr);
\r
115 g_hash_table_insert (ctx->addresses, key, mailbox);
\r