Re: bug#6214: 23.1; json-read-string crashes emacs with long string
[notmuch-archives.git] / e1 / e3513e354e65a4cbe459c2a5bf48d53b903589
1 Return-Path: <Sebastian@SSpaeth.de>\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 497E5431FBD\r
6         for <notmuch@notmuchmail.org>; Tue,  2 Mar 2010 02:52:47 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.92\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.92 tagged_above=-999 required=5 tests=[AWL=0.679, \r
12         BAYES_00=-2.599] autolearn=ham\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 r+DFvsQxsnM3 for <notmuch@notmuchmail.org>;\r
16         Tue,  2 Mar 2010 02:52:46 -0800 (PST)\r
17 Received: from homiemail-a13.g.dreamhost.com (caiajhbdcahe.dreamhost.com\r
18         [208.97.132.74])\r
19         by olra.theworths.org (Postfix) with ESMTP id A6B61431FAE\r
20         for <notmuch@notmuchmail.org>; Tue,  2 Mar 2010 02:52:46 -0800 (PST)\r
21 Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
22         [129.132.133.204])\r
23         by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id 1D25A6A8073; \r
24         Tue,  2 Mar 2010 02:52:36 -0800 (PST)\r
25 From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
26 To: notmuch@notmuchmail.org\r
27 Date: Tue,  2 Mar 2010 11:52:32 +0100\r
28 Message-Id: <1267527153-8364-1-git-send-email-Sebastian@SSpaeth.de>\r
29 X-Mailer: git-send-email 1.6.3.3\r
30 In-Reply-To: <87k4twc5dh.fsf@servo.finestructure.net>\r
31 References: <87k4twc5dh.fsf@servo.finestructure.net>\r
32 Subject: [notmuch] [PATCH 1/2] notmuch-show: Do not output (null) when the\r
33         message body is empty\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Tue, 02 Mar 2010 10:52:47 -0000\r
47 \r
48 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
49 ---\r
50 I actually agree that we should output tags as array, it was just that the get_tags_as_string function was already existing, so that was more convenient. Here comes the second iteration that outputs the tags as json array.\r
51 \r
52  notmuch-show.c |    6 ++++--\r
53  1 files changed, 4 insertions(+), 2 deletions(-)\r
54 \r
55 diff --git a/notmuch-show.c b/notmuch-show.c\r
56 index 1a1d601..f21914f 100644\r
57 --- a/notmuch-show.c\r
58 +++ b/notmuch-show.c\r
59 @@ -311,8 +311,10 @@ format_part_json (GMimeObject *part, int *part_count)\r
60      {\r
61         show_part_content (part, stream_memory);\r
62         part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM (stream_memory));\r
63 -\r
64 -       printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));\r
65 +       if (part_content->data != NULL)\r
66 +         printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));\r
67 +       else\r
68 +         printf (", \"content\": \"\"");\r
69      }\r
70  \r
71      fputs ("}", stdout);\r
72 -- \r
73 1.6.3.3\r
74 \r