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 EF299431FAE
\r
6 for <notmuch@notmuchmail.org>; Mon, 30 Apr 2012 09:25:46 -0700 (PDT)
\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 fbUDJvI5xjuT for <notmuch@notmuchmail.org>;
\r
16 Mon, 30 Apr 2012 09:25:46 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 05B5B429E25
\r
20 for <notmuch@notmuchmail.org>; Mon, 30 Apr 2012 09:25:44 -0700 (PDT)
\r
21 X-AuditID: 12074424-b7fae6d000000906-ec-4f9ebd08d2bf
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id C1.7E.02310.80DBE9F4; Mon, 30 Apr 2012 12:25:44 -0400 (EDT)
\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 q3UGPiiC001282;
\r
27 Mon, 30 Apr 2012 12:25:44 -0400
\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 q3UGPgXp005257
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Mon, 30 Apr 2012 12:25:43 -0400 (EDT)
\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 1SOtPx-0006HA-O3; Mon, 30 Apr 2012 12:25:41 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v2 3/6] go: Update Go bindings for new notmuch_database_{open,
\r
42 Date: Mon, 30 Apr 2012 12:25:35 -0400
\r
43 Message-Id: <1335803138-24024-4-git-send-email-amdragon@mit.edu>
\r
44 X-Mailer: git-send-email 1.7.9.1
\r
45 In-Reply-To: <1335803138-24024-1-git-send-email-amdragon@mit.edu>
\r
46 References: <1335651473-19652-1-git-send-email-amdragon@mit.edu>
\r
47 <1335803138-24024-1-git-send-email-amdragon@mit.edu>
\r
48 X-Brightmail-Tracker:
\r
49 H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixG6nrsuxd56/wczLuhbXb85kdmD0eLbq
\r
50 FnMAYxSXTUpqTmZZapG+XQJXxuL+VUwF1/grmm59Y2lgPMPTxcjJISFgIrHn7wpmCFtM4sK9
\r
51 9WxdjFwcQgL7GCVe/N0L5WxglPj5voMZwrnPJDHz9h1GCGc+o8Tpt+uYQPrZBDQktu1fzghi
\r
52 iwhIS+y8O5u1i5GDg1lATeJPlwpIWFggQeLZhfdsIDaLgKrE6j9zWUBsXgEHiQ0n7rNDnKEg
\r
53 8WzdcbCRnAKOErcOfAOrERIol9h44RPjBEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3TN
\r
54 9XIzS/RSU0o3MYLDxkVlB2PzIaVDjAIcjEo8vC8XzvMXYk0sK67MPcQoycGkJMqruwcoxJeU
\r
55 n1KZkVicEV9UmpNafIhRgoNZSYS3dCJQjjclsbIqtSgfJiXNwaIkzquh9c5PSCA9sSQ1OzW1
\r
56 ILUIJivDwaEkwWsPMlSwKDU9tSItM6cEIc3EwQkynAdoOFgNb3FBYm5xZjpE/hSjopQ4LwNI
\r
57 QgAkkVGaB9cLi+tXjOJArwjzSoBU8QBTAlz3K6DBTECD883BBpckIqSkGhi1Zr5f2L0g+oJT
\r
58 pJdgQ+jupoI/mvuD5kq6z743zXt/cO+s0E2WBopxk/awhT4+bfAh6ycrb+eU1jCWtNToxNfT
\r
59 DvKJPKk2Tn56h3XRycxjVRLzrx1TMljAxOsf/UZrS6jfJI0NtYZHz0b9KAvwbmb8etR+RYbB
\r
60 26n8smZdXTOdXZi1JihdtVRiKc5INNRiLipOBACNwu0RxgIAAA==
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Mon, 30 Apr 2012 16:25:47 -0000
\r
75 This requires changing the return types of NewDatabase and
\r
76 OpenDatabase to follow the standard Go convention for returning
\r
79 bindings/go/pkg/notmuch.go | 24 ++++++++++++------------
\r
80 1 files changed, 12 insertions(+), 12 deletions(-)
\r
82 diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go
\r
83 index d32901d..86e9645 100644
\r
84 --- a/bindings/go/pkg/notmuch.go
\r
85 +++ b/bindings/go/pkg/notmuch.go
\r
86 @@ -86,21 +86,21 @@ const (
\r
89 // Create a new, empty notmuch database located at 'path'
\r
90 -func NewDatabase(path string) *Database {
\r
91 +func NewDatabase(path string) (*Database, Status) {
\r
93 var c_path *C.char = C.CString(path)
\r
94 defer C.free(unsafe.Pointer(c_path))
\r
98 + return nil, STATUS_OUT_OF_MEMORY
\r
101 self := &Database{db:nil}
\r
102 - self.db = C.notmuch_database_create(c_path)
\r
103 - if self.db == nil {
\r
105 + st := Status(C.notmuch_database_create(c_path, &self.db))
\r
106 + if st != STATUS_SUCCESS {
\r
113 /* Open an existing notmuch database located at 'path'.
\r
114 @@ -120,21 +120,21 @@ func NewDatabase(path string) *Database {
\r
115 * In case of any failure, this function returns NULL, (after printing
\r
116 * an error message on stderr).
\r
118 -func OpenDatabase(path string, mode DatabaseMode) *Database {
\r
119 +func OpenDatabase(path string, mode DatabaseMode) (*Database, Status) {
\r
121 var c_path *C.char = C.CString(path)
\r
122 defer C.free(unsafe.Pointer(c_path))
\r
126 + return nil, STATUS_OUT_OF_MEMORY
\r
129 self := &Database{db:nil}
\r
130 - self.db = C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode))
\r
131 - if self.db == nil {
\r
133 + st := Status(C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode), &self.db))
\r
134 + if st != STATUS_SUCCESS {
\r
141 /* Close the given notmuch database, freeing all associated
\r