Re: [PATCH v4 16/16] add "notmuch reindex" subcommand
[notmuch-archives.git] / 5b / d1431a4cec35f2273d12755a43e9891d5b3f40
1 Return-Path: <djcb@djcbsoftware.nl>\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 334F2431FBC\r
6         for <notmuch@notmuchmail.org>; Tue,  1 Dec 2009 23:11:31 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id Bv44v4QL9f+G for <notmuch@notmuchmail.org>;\r
11         Tue,  1 Dec 2009 23:11:29 -0800 (PST)\r
12 Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi\r
13         [195.197.172.115])\r
14         by olra.theworths.org (Postfix) with ESMTP id 72CD9431FAE\r
15         for <notmuch@notmuchmail.org>; Tue,  1 Dec 2009 23:11:29 -0800 (PST)\r
16 Received: from djcbsoftware.nl (a88-112-254-208.elisa-laajakaista.fi\r
17         [88.112.254.208])\r
18         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by gw01.mail.saunalahti.fi (Postfix) with ESMTP id 56503151684;\r
21         Wed,  2 Dec 2009 09:11:26 +0200 (EET)\r
22 Received: by djcbsoftware.nl (Postfix, from userid 1000)\r
23         id 1576339C034; Wed,  2 Dec 2009 09:11:25 +0200 (EET)\r
24 From: "Dirk-Jan C. Binnema" <djcb.bulk@gmail.com>\r
25 To: notmuch@notmuchmail.org\r
26 Date: Wed,  2 Dec 2009 09:11:25 +0200\r
27 Message-Id: <1259737885-15103-2-git-send-email-djcb.bulk@gmail.com>\r
28 X-Mailer: git-send-email 1.6.3.3\r
29 In-Reply-To: <1259737885-15103-1-git-send-email-djcb.bulk@gmail.com>\r
30 References: <1259737885-15103-1-git-send-email-djcb.bulk@gmail.com>\r
31 Subject: [notmuch] [PATCH 2/2] * free the response data from 'prompt'\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.12\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Wed, 02 Dec 2009 07:11:32 -0000\r
45 \r
46 Free the results of the prompt; this patch does the minimal job for that.\r
47 It may be nice to refactor the function a bit. \r
48 \r
49 Signed-off-by: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>\r
50 ---\r
51  notmuch-setup.c |   15 +++++++++++++--\r
52  1 files changed, 13 insertions(+), 2 deletions(-)\r
53 \r
54 diff --git a/notmuch-setup.c b/notmuch-setup.c\r
55 index 622bbaa..293c852 100644\r
56 --- a/notmuch-setup.c\r
57 +++ b/notmuch-setup.c\r
58 @@ -119,12 +119,16 @@ notmuch_setup_command (unused (void *ctx),\r
59      prompt ("Your full name [%s]: ", notmuch_config_get_user_name (config));\r
60      if (strlen (response))\r
61         notmuch_config_set_user_name (config, response);\r
62 -\r
63 +    free (response);\r
64 +    response = NULL;\r
65 +    \r
66      prompt ("Your primary email address [%s]: ",\r
67             notmuch_config_get_user_primary_email (config));\r
68      if (strlen (response))\r
69         notmuch_config_set_user_primary_email (config, response);\r
70 -\r
71 +    free (response);\r
72 +    response = NULL;\r
73 +    \r
74      other_emails = g_ptr_array_new ();\r
75  \r
76      old_other_emails = notmuch_config_get_user_other_email (config,\r
77 @@ -136,12 +140,17 @@ notmuch_setup_command (unused (void *ctx),\r
78         else\r
79             g_ptr_array_add (other_emails, talloc_strdup (ctx,\r
80                                                          old_other_emails[i]));\r
81 +       free (response);\r
82 +       response = NULL;\r
83      }\r
84  \r
85      do {\r
86         prompt ("Additional email address [Press 'Enter' if none]: ");\r
87         if (strlen (response))\r
88             g_ptr_array_add (other_emails, talloc_strdup (ctx, response));\r
89 +       free (response);\r
90 +       response = NULL;\r
91 +       \r
92      } while (strlen (response));\r
93      if (other_emails->len)\r
94         notmuch_config_set_user_other_email (config,\r
95 @@ -158,6 +167,8 @@ notmuch_setup_command (unused (void *ctx),\r
96         absolute_path = make_path_absolute (ctx, response);\r
97         notmuch_config_set_database_path (config, absolute_path);\r
98      }\r
99 +    free (response);\r
100 +    response = NULL;\r
101  \r
102      if (! notmuch_config_save (config)) {\r
103         if (is_new)\r
104 -- \r
105 1.6.3.3\r
106 \r