From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D5AE8431FC9 for ; Sat, 28 Apr 2012 15:18:02 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2RYtR0TQFDF2 for ; Sat, 28 Apr 2012 15:18:01 -0700 (PDT) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 67EFF431FB6 for ; Sat, 28 Apr 2012 15:18:01 -0700 (PDT) X-AuditID: 1209190f-b7f4f6d00000092b-2c-4f9c6c97cba7 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 30.91.02347.79C6C9F4; Sat, 28 Apr 2012 18:17:59 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q3SMHwYC028568; Sat, 28 Apr 2012 18:17:58 -0400 Received: from drake.mit.edu (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3SMHvqb008920 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 28 Apr 2012 18:17:58 -0400 (EDT) Received: from amthrax by drake.mit.edu with local (Exim 4.77) (envelope-from ) id 1SOFxl-00058J-6z; Sat, 28 Apr 2012 18:17:57 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 3/6] go: Update Go bindings for new notmuch_database_{open, create} signatures Date: Sat, 28 Apr 2012 18:17:50 -0400 Message-Id: <1335651473-19652-4-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1335651473-19652-1-git-send-email-amdragon@mit.edu> References: <1335651473-19652-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixG6nojs9Z46/waEnEhbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxuL+VUwF1/grmm59Y2lgPMPTxcjJISFgIrHu7WR2CFtM4sK9 9WxdjFwcQgL7GCXmd9xkh3A2MEo8uv8cKnOfSeLbtimMEM58RokjW/+zgvSzCWhIbNu/nBHE FhGQlth5dzZQnIODWUBN4k+XCkhYWCBWou/4PDYQm0VAVeJb5ywWEJtXwEHi69qpbBBnKEg8 W3ecCcTmFHCU+L/5BNh5QkA1HfMmsE1g5F/AyLCKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI10Qv N7NELzWldBMjKGw4Jfl3MH47qHSIUYCDUYmH98j6Wf5CrIllxZW5hxglOZiURHlZsub4C/El 5adUZiQWZ8QXleakFh9ilOBgVhLh1RYHyvGmJFZWpRblw6SkOViUxHnVtN75CQmkJ5akZqem FqQWwWRlODiUJHiPZgM1ChalpqdWpGXmlCCkmTg4QYbzAA3/DlLDW1yQmFucmQ6RP8WoKCUO kRAASWSU5sH1wuL6FaM40CvCvFzAKBfiAaYEuO5XQIOZgAYzec4CGVySiJCSamC0+rTS53CH xY/aL32+Ta1by+t2qEZ4zz5zx5B1zxO2ilmKe2PnanL//hb5cXuI8IGXN5yty1cJbr4U3ixg P2vGtIr/ki99C/Wl1Zabat5yu9H4dM3hWY+nfcrVaokS9wmpLjphcD/Mf93lqHMPRVpOfpk/ Ty5DzHyrZYbihtMFwY7S7Abf9ixVYinOSDTUYi4qTgQAhFOZDsYCAAA= X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2012 22:18:03 -0000 This requires changing the return types of NewDatabase and OpenDatabase to follow the standard Go convention for returning errors. --- bindings/go/pkg/notmuch.go | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go index d32901d..86e9645 100644 --- a/bindings/go/pkg/notmuch.go +++ b/bindings/go/pkg/notmuch.go @@ -86,21 +86,21 @@ const ( ) // Create a new, empty notmuch database located at 'path' -func NewDatabase(path string) *Database { +func NewDatabase(path string) (*Database, Status) { var c_path *C.char = C.CString(path) defer C.free(unsafe.Pointer(c_path)) if c_path == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } self := &Database{db:nil} - self.db = C.notmuch_database_create(c_path) - if self.db == nil { - return nil + st := Status(C.notmuch_database_create(c_path, &self.db)) + if st != STATUS_SUCCESS { + return nil, st } - return self + return self, st } /* Open an existing notmuch database located at 'path'. @@ -120,21 +120,21 @@ func NewDatabase(path string) *Database { * In case of any failure, this function returns NULL, (after printing * an error message on stderr). */ -func OpenDatabase(path string, mode DatabaseMode) *Database { +func OpenDatabase(path string, mode DatabaseMode) (*Database, Status) { var c_path *C.char = C.CString(path) defer C.free(unsafe.Pointer(c_path)) if c_path == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } self := &Database{db:nil} - self.db = C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode)) - if self.db == nil { - return nil + st := Status(C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode), &self.db)) + if st != STATUS_SUCCESS { + return nil, st } - return self + return self, st } /* Close the given notmuch database, freeing all associated -- 1.7.9.1