From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 4CD516DE1105 for ; Sat, 12 Aug 2017 07:15:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QxoMRAXmJzgV for ; Sat, 12 Aug 2017 07:15:44 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id A5BE26DE10E8 for ; Sat, 12 Aug 2017 07:15:44 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dgX9A-0008AO-NR; Sat, 12 Aug 2017 10:12:12 -0400 Received: (nullmailer pid 4779 invoked by uid 1000); Sat, 12 Aug 2017 14:15:40 -0000 From: David Bremner To: Kamil Klimkiewicz , notmuch@notmuchmail.org Subject: Re: [PATCH] go: update bindings to compile with notmuch 0.25 In-Reply-To: References: Date: Sat, 12 Aug 2017 10:15:40 -0400 Message-ID: <87lgmozxbn.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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, 12 Aug 2017 14:15:45 -0000 Kamil Klimkiewicz writes: > Attached is a simple patch that fixes go bindings to compile with > notmuch 0.25. Please note it doesn't change the go API, ie. go methods > *don't* return Status values. I am not sure you also want to break go > API with the update. If you do, I can update the patch to return > go-idiomatic (*Messages, Status) tuple. for some reason this patch doesn't apply to current master > --- > contrib/go/src/notmuch/notmuch.go | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/contrib/go/src/notmuch/notmuch.go > b/contrib/go/src/notmuch/notmuch.go > index 2d684311..936f927c 100644 > --- a/contrib/go/src/notmuch/notmuch.go > +++ b/contrib/go/src/notmuch/notmuch.go > @@ -455,11 +455,12 @@ func (self *Query) GetSort() Sort { > * If a Xapian exception occurs this function will return NULL. > */ > func (self *Query) SearchThreads() *Threads { > - threads := C.notmuch_query_search_threads(self.query) > - if threads == nil { > + var threads Threads > + C.notmuch_query_search_threads(self.query, &threads.threads) > + if threads.threads == nil { it seems like it would be better to check the return value of notmuch_query_search_threads here, wouldn't it? > /* Destroy a notmuch_query_t along with any associated resources. > @@ -531,7 +533,9 @@ func (self *Query) Destroy() { > * printing a message). > */ > func (self *Query) CountMessages() uint { > - return uint(C.notmuch_query_count_messages(self.query)) > + var count C.uint > + C.notmuch_query_count_messages(self.query, &count) > + return uint(count) > } Here especially you should check the return value since the API does not promise anything about the value of count in case of errors. d