From: David Bremner <david@tethera.net>
To: Kamil Klimkiewicz <miglanz@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH] go: update bindings to compile with notmuch 0.25
Date: Sat, 12 Aug 2017 10:15:40 -0400 [thread overview]
Message-ID: <87lgmozxbn.fsf@tethera.net> (raw)
In-Reply-To: <CAAHE_TG1StdeSU9whwD4ZUnZq=DeDHDn6u3QWSrfsgmMWS+RYw@mail.gmail.com>
Kamil Klimkiewicz <miglanz@gmail.com> 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
prev parent reply other threads:[~2017-08-12 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 9:58 [PATCH] go: update bindings to compile with notmuch 0.25 Kamil Klimkiewicz
2017-08-08 13:40 ` David Bremner
2017-08-12 14:15 ` David Bremner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lgmozxbn.fsf@tethera.net \
--to=david@tethera.net \
--cc=miglanz@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).