1 Return-Path: <amthrax@drake.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 9539A429E30
\r
6 for <notmuch@notmuchmail.org>; Tue, 14 Feb 2012 09:34:06 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 U52F3E-IA0St for <notmuch@notmuchmail.org>;
\r
16 Tue, 14 Feb 2012 09:34:05 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 55482431FD6
\r
20 for <notmuch@notmuchmail.org>; Tue, 14 Feb 2012 09:34:01 -0800 (PST)
\r
21 X-AuditID: 1209190e-b7f7c6d0000008c3-64-4f3a9b082ed0
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id DC.1A.02243.80B9A3F4; Tue, 14 Feb 2012 12:34:00 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q1EHY0AA019628;
\r
27 Tue, 14 Feb 2012 12:34:00 -0500
\r
28 Received: from drake.mit.edu
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1EHXw6u016514
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Tue, 14 Feb 2012 12:33:59 -0500 (EST)
\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.77)
\r
36 (envelope-from <amthrax@drake.mit.edu>)
\r
37 id 1RxMGM-00027K-Mv; Tue, 14 Feb 2012 12:33:58 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 5/8] show: Simplify talloc use in format_headers_json
\r
41 Date: Tue, 14 Feb 2012 12:33:40 -0500
\r
42 Message-Id: <1329240823-7856-6-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.7.3
\r
44 In-Reply-To: <1329240823-7856-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1329240823-7856-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrssx28rf4NQTPYsje2axW1zd2s9u
\r
48 cf3mTGYHZo+ds+6yezxbdYvZo+nHYtYA5igum5TUnMyy1CJ9uwSujHVrP7AWtEtUTHtxn7WB
\r
49 8Z5wFyMnh4SAicSP+/8YIWwxiQv31rN1MXJxCAnsY5RoWbGFGcLZwChxedZeJgjnPpPEhlu9
\r
50 UM58RonTbQ3MIP1sAhoS2/YvB5slIiAtsfPubFYQm1kgXuJI23qwuLCAq8ShucvB4iwCqhIv
\r
51 1ywB6uXg4BWwl9jyJg/iDAWJc6vPsYPYnAIOEvv3/QcrFwIquXR3K8sERv4FjAyrGGVTcqt0
\r
52 cxMzc4pTk3WLkxPz8lKLdI31cjNL9FJTSjcxgsKLU5JvB+PXg0qHGAU4GJV4eA0sLP2FWBPL
\r
53 iitzDzFKcjApifIKz7DyF+JLyk+pzEgszogvKs1JLT7EKMHBrCTCu2k6UI43JbGyKrUoHyYl
\r
54 zcGiJM6rpvXOT0ggPbEkNTs1tSC1CCYrw8GhJMGbNAuoUbAoNT21Ii0zpwQhzcTBCTKcB2h4
\r
55 MkgNb3FBYm5xZjpE/hSjopQ4rwdIQgAkkVGaB9cLi/9XjOJArwjzBoFU8QBTB1z3K6DBTECD
\r
56 t5+2ABlckoiQkmpgXHqb8VprwIxm+UvfzIplZ0jKPRHNX3Xpu7JC243Kgzu2rv33vKmV23r6
\r
57 AYHVQepmWwKXmrm+mCIU8GVjq8+jMwYmP+LOJT1bOU2/Yb/U6osLX5QEy4kWtHYdjisP5nu5
\r
58 5edM8TLGVG8H+ZdHFi1dr30vMUZ/lcrGJ5EvNRLM62d+3T+xzcszQYmlOCPRUIu5qDgRAFfO
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Tue, 14 Feb 2012 17:34:07 -0000
\r
74 Previously there was an unnecessary talloc context.
\r
76 notmuch-show.c | 32 +++++++++++++++-----------------
\r
77 1 files changed, 15 insertions(+), 17 deletions(-)
\r
79 diff --git a/notmuch-show.c b/notmuch-show.c
\r
80 index 209ff45..6259d30 100644
\r
81 --- a/notmuch-show.c
\r
82 +++ b/notmuch-show.c
\r
83 @@ -291,37 +291,35 @@ format_headers_message_part_text (GMimeMessage *message)
\r
87 -format_headers_json (GMimeMessage *message)
\r
88 +format_headers_json (const void *ctx, GMimeMessage *message)
\r
90 - void *ctx = talloc_new (NULL);
\r
91 - void *ctx_quote = talloc_new (ctx);
\r
92 + void *local = talloc_new (ctx);
\r
93 InternetAddressList *recipients;
\r
94 const char *recipients_string;
\r
97 - json_quote_str (ctx_quote, "Subject"),
\r
98 - json_quote_str (ctx_quote, g_mime_message_get_subject (message)));
\r
99 + json_quote_str (local, "Subject"),
\r
100 + json_quote_str (local, g_mime_message_get_subject (message)));
\r
101 printf (", %s: %s",
\r
102 - json_quote_str (ctx_quote, "From"),
\r
103 - json_quote_str (ctx_quote, g_mime_message_get_sender (message)));
\r
104 + json_quote_str (local, "From"),
\r
105 + json_quote_str (local, g_mime_message_get_sender (message)));
\r
106 recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
\r
107 recipients_string = internet_address_list_to_string (recipients, 0);
\r
108 if (recipients_string)
\r
109 printf (", %s: %s",
\r
110 - json_quote_str (ctx_quote, "To"),
\r
111 - json_quote_str (ctx_quote, recipients_string));
\r
112 + json_quote_str (local, "To"),
\r
113 + json_quote_str (local, recipients_string));
\r
114 recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
\r
115 recipients_string = internet_address_list_to_string (recipients, 0);
\r
116 if (recipients_string)
\r
117 printf (", %s: %s",
\r
118 - json_quote_str (ctx_quote, "Cc"),
\r
119 - json_quote_str (ctx_quote, recipients_string));
\r
120 + json_quote_str (local, "Cc"),
\r
121 + json_quote_str (local, recipients_string));
\r
122 printf (", %s: %s",
\r
123 - json_quote_str (ctx_quote, "Date"),
\r
124 - json_quote_str (ctx_quote, g_mime_message_get_date_as_string (message)));
\r
125 + json_quote_str (local, "Date"),
\r
126 + json_quote_str (local, g_mime_message_get_date_as_string (message)));
\r
128 - talloc_free (ctx_quote);
\r
129 - talloc_free (ctx);
\r
130 + talloc_free (local);
\r
133 /* Write a MIME text part out to the given stream.
\r
134 @@ -661,7 +659,7 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)
\r
135 format_message_json (ctx, node->envelope_file);
\r
137 printf ("\"headers\": {");
\r
138 - format_headers_json (GMIME_MESSAGE (node->part));
\r
139 + format_headers_json (ctx, GMIME_MESSAGE (node->part));
\r
142 printf (", \"body\": [");
\r
143 @@ -749,7 +747,7 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)
\r
145 if (GMIME_IS_MESSAGE (node->part)) {
\r
146 printf ("\"headers\": {");
\r
147 - format_headers_json (GMIME_MESSAGE (node->part));
\r
148 + format_headers_json (local, GMIME_MESSAGE (node->part));
\r
151 printf (", \"body\": [");
\r