1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 D1A86431FC3
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 Mar 2015 00:44:35 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 dvrd5YXFPaVD for <notmuch@notmuchmail.org>;
\r
16 Sat, 7 Mar 2015 00:44:35 -0800 (PST)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 8F2E6431FBC
\r
22 for <notmuch@notmuchmail.org>; Sat, 7 Mar 2015 00:44:32 -0800 (PST)
\r
23 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
24 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
25 id 1YUAKs-0002Jo-Gp; Sat, 07 Mar 2015 08:43:50 +0000
\r
26 Received: (nullmailer pid 20412 invoked by uid 1000); Sat, 07 Mar 2015
\r
28 From: David Bremner <david@tethera.net>
\r
29 To: notmuch@notmuchmail.org
\r
30 Subject: [PATCH 3/4] ruby: update bindings for new count API
\r
31 Date: Sat, 7 Mar 2015 09:43:16 +0100
\r
32 Message-Id: <1425717797-19990-4-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 2.1.4
\r
34 In-Reply-To: <1425717797-19990-1-git-send-email-david@tethera.net>
\r
35 References: <1419971380-10307-6-git-send-email-david@tethera.net>
\r
36 <1425717797-19990-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sat, 07 Mar 2015 08:44:36 -0000
\r
51 Compared to the CLI changes, this does something clearly useful,
\r
52 transforming an error status into a ruby exception.
\r
54 bindings/ruby/query.c | 26 ++++++++++++++++----------
\r
55 1 file changed, 16 insertions(+), 10 deletions(-)
\r
57 diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c
\r
58 index a7dacba..ea9ca37 100644
\r
59 --- a/bindings/ruby/query.c
\r
60 +++ b/bindings/ruby/query.c
\r
61 @@ -173,14 +173,17 @@ VALUE
\r
62 notmuch_rb_query_count_messages (VALUE self)
\r
64 notmuch_query_t *query;
\r
65 + notmuch_status_t status;
\r
68 Data_Get_Notmuch_Query (self, query);
\r
70 - /* Xapian exceptions are not handled properly.
\r
71 - * (function may return 0 after printing a message)
\r
72 - * Thus there is nothing we can do here...
\r
74 - return UINT2NUM(notmuch_query_count_messages(query));
\r
75 + status = notmuch_query_count_messages_st (query, &count);
\r
78 + notmuch_rb_status_raise (status);
\r
80 + return UINT2NUM(count);
\r
84 @@ -192,12 +195,15 @@ VALUE
\r
85 notmuch_rb_query_count_threads (VALUE self)
\r
87 notmuch_query_t *query;
\r
88 + notmuch_status_t status;
\r
91 Data_Get_Notmuch_Query (self, query);
\r
93 - /* Xapian exceptions are not handled properly.
\r
94 - * (function may return 0 after printing a message)
\r
95 - * Thus there is nothing we can do here...
\r
97 - return UINT2NUM(notmuch_query_count_threads(query));
\r
98 + status = notmuch_query_count_threads_st (query, &count);
\r
100 + notmuch_rb_status_raise (status);
\r
102 + return UINT2NUM(count);
\r