Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 23 / 2aecb8452cfbe9b7699c437ba4c4842db11ff5
1 Return-Path: <david@tethera.net>\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 A9E5F431FC0\r
6         for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 15:28:39 -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: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 xpFKmAV41V5a for <notmuch@notmuchmail.org>;\r
16         Sun, 19 Jan 2014 15:28:35 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 95534431FBD\r
21         for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 15:28:35 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <david@tethera.net>)\r
24         id 1W51n6-0001pZ-Ez; Sun, 19 Jan 2014 19:28:32 -0400\r
25 Received: (nullmailer pid 8058 invoked by uid 1000); Sun, 19 Jan 2014\r
26         23:28:28 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
29 Subject: Re: [PATCH v2] lib: add return status to database close and destroy\r
30 In-Reply-To: <1390152046-6509-1-git-send-email-jani@nikula.org>\r
31 References: <1390152046-6509-1-git-send-email-jani@nikula.org>\r
32 User-Agent: Notmuch/0.17+35~g3b36898 (http://notmuchmail.org) Emacs/24.3.1\r
33         (x86_64-pc-linux-gnu)\r
34 Date: Sun, 19 Jan 2014 19:28:28 -0400\r
35 Message-ID: <87ob37k0v7.fsf@zancas.localnet>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sun, 19 Jan 2014 23:28:39 -0000\r
51 \r
52 Jani Nikula <jani@nikula.org> writes:\r
53 \r
54 > -void\r
55 > +notmuch_status_t\r
56 >  notmuch_database_close (notmuch_database_t *notmuch)\r
57 >  {\r
58 > +    notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;\r
59 > +\r
60 >      try {\r
61 >       if (notmuch->xapian_db != NULL &&\r
62 >           notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)\r
63 >           (static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db))->flush ();\r
64 >      } catch (const Xapian::Error &error) {\r
65 > +     status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
66 >       if (! notmuch->exception_reported) {\r
67 \r
68 as I mentioned on IRC, I don't really know what this piece of code is\r
69 useful for, but that's orthogonal to this patch.\r
70 \r
71 > -void\r
72 > +notmuch_status_t\r
73 >  notmuch_database_destroy (notmuch_database_t *notmuch)\r
74 >  {\r
75 > -    notmuch_database_close (notmuch);\r
76 > +    notmuch_status_t status;\r
77 > +\r
78 > +    status = notmuch_database_close (notmuch);\r
79 >      talloc_free (notmuch);\r
80 > +\r
81 > +    return status;\r
82 >  }\r
83 \r
84 I guess we're implicitly claiming that talloc_free cannot possibly\r
85 return -1 in our use case? perhaps a cast to void and/or a comment would\r
86 be suitable.\r
87 \r
88 >  const char *\r
89 > diff --git a/lib/notmuch.h b/lib/notmuch.h\r
90 > index 02604c5..7ac7118 100644\r
91 > --- a/lib/notmuch.h\r
92 > +++ b/lib/notmuch.h\r
93 > @@ -287,8 +287,16 @@ notmuch_database_open (const char *path,\r
94 >   *\r
95 >   * notmuch_database_close can be called multiple times.  Later calls\r
96 >   * have no effect.\r
97 \r
98 Is it conceivable that the user might wish to retry closing if an\r
99 exception occurs? It feels like we ought to have an opinion here.\r
100 \r
101 No functionality complaints...\r
102 \r
103 d\r