[PATCH] fix notmuch_database_open call in addrlookup

Subject: [PATCH] fix notmuch_database_open call in addrlookup

Date: Wed, 31 Oct 2012 12:43:24 -0400

To: notmuch mailing list


From: James Vasile

What's the best way to submit changes to addrlookup?  Right now, it is
out of date vs the latest libnotmuch.  The addrlookup repo is vala code
but the wiki [1] points to a generated c file [2].

[1] http://github.com/spaetz/vala-notmuch/raw/static-sources/src/addrlookup.c
[2] http://notmuchmail.org/emacstips/

At any rate, a patch to that c file is below.  If you upgraded notmuch
and now addrlookup gives errors about not finding libnotmuch.so.2, this
patch might be what you need.

In the latest version of notmuch in git, notmuch_database_open returns a
status and takes what used to be the return value as a reference
parameter.  This patch adjusts code to pass the db pointer in a
parameter and accept the status as return value.  We don't do anything
with the status at present.

 addrlookup.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/addrlookup.c b/addrlookup.c
index 5f724ef..aed77e7 100644
--- a/addrlookup.c
+++ b/addrlookup.c
@@ -804,12 +804,14 @@ void address_matcher_run (AddressMatcher* self, const gchar* name) {
        gchar** _result_;
        gint _result__length1;
        gint __result__size_;
+       notmuch_status_t status;
        g_return_if_fail (self != NULL);
        _tmp0_ = g_new0 (notmuch_query_t*, 0);
        queries = _tmp0_;
        queries_length1 = 0;
        _queries_size_ = 0;
-       _tmp1_ = notmuch_database_open (self->priv->user_db_path, NOTMUCH_DATABASE_MODE_READ_ONLY);
+       status = notmuch_database_open (self->priv->user_db_path, NOTMUCH_DATABASE_MODE_READ_ONLY, &_tmp1_);
        _notmuch_database_close0 (self->priv->db);
        self->priv->db = _tmp1_;
        _tmp2_ = g_strconcat ("tag:", self->priv->user_addrbook_tag, NULL);

part-000.sig (application/pgp-signature)