1 Return-Path: <bremner@tethera.net>
\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 arlo.cworth.org (Postfix) with ESMTP id EF0066DE176C
\r
6 for <notmuch@notmuchmail.org>; Sat, 26 Sep 2015 19:52:07 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.112 tagged_above=-999 required=5 tests=[AWL=0.112]
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id j9LxVyVnEY-A for <notmuch@notmuchmail.org>;
\r
16 Sat, 26 Sep 2015 19:52:06 -0700 (PDT)
\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])
\r
18 by arlo.cworth.org (Postfix) with ESMTPS id 3BA966DE141E
\r
19 for <notmuch@notmuchmail.org>; Sat, 26 Sep 2015 19:52:06 -0700 (PDT)
\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)
\r
21 (envelope-from <bremner@tethera.net>)
\r
22 id 1Zg23f-0005bX-SW; Sun, 27 Sep 2015 02:51:23 +0000
\r
23 Received: (nullmailer pid 31139 invoked by uid 1000); Sun, 27 Sep 2015
\r
25 From: David Bremner <david@tethera.net>
\r
26 To: notmuch@notmuchmail.org
\r
27 Subject: [Patch v3 4/4] ruby: use new count API
\r
28 Date: Sat, 26 Sep 2015 23:50:13 -0300
\r
29 Message-Id: <1443322213-31075-5-git-send-email-david@tethera.net>
\r
30 X-Mailer: git-send-email 2.5.3
\r
31 In-Reply-To: <1443322213-31075-1-git-send-email-david@tethera.net>
\r
32 References: <1443322213-31075-1-git-send-email-david@tethera.net>
\r
33 X-BeenThere: notmuch@notmuchmail.org
\r
34 X-Mailman-Version: 2.1.18
\r
36 List-Id: "Use and development of the notmuch mail system."
\r
37 <notmuch.notmuchmail.org>
\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
39 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
41 List-Post: <mailto:notmuch@notmuchmail.org>
\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
45 X-List-Received-Date: Sun, 27 Sep 2015 02:52:08 -0000
\r
47 This change of replacing ignoring errors with exceptions is intended,
\r
48 and indeed one of the main motivations for the libnotmuch API changes.
\r
50 bindings/ruby/query.c | 24 ++++++++++++++----------
\r
51 1 file changed, 14 insertions(+), 10 deletions(-)
\r
53 diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c
\r
54 index a7dacba..f87700a 100644
\r
55 --- a/bindings/ruby/query.c
\r
56 +++ b/bindings/ruby/query.c
\r
57 @@ -173,14 +173,16 @@ VALUE
\r
58 notmuch_rb_query_count_messages (VALUE self)
\r
60 notmuch_query_t *query;
\r
61 + notmuch_status_t status;
\r
62 + unsigned int count;
\r
64 Data_Get_Notmuch_Query (self, query);
\r
66 - /* Xapian exceptions are not handled properly.
\r
67 - * (function may return 0 after printing a message)
\r
68 - * Thus there is nothing we can do here...
\r
70 - return UINT2NUM(notmuch_query_count_messages(query));
\r
71 + status = notmuch_query_count_messages_st (query, &count);
\r
73 + notmuch_rb_status_raise (status);
\r
75 + return UINT2NUM(count);
\r
79 @@ -192,12 +194,14 @@ VALUE
\r
80 notmuch_rb_query_count_threads (VALUE self)
\r
82 notmuch_query_t *query;
\r
83 + notmuch_status_t status;
\r
84 + unsigned int count;
\r
86 Data_Get_Notmuch_Query (self, query);
\r
88 - /* Xapian exceptions are not handled properly.
\r
89 - * (function may return 0 after printing a message)
\r
90 - * Thus there is nothing we can do here...
\r
92 - return UINT2NUM(notmuch_query_count_threads(query));
\r
93 + status = notmuch_query_count_threads_st (query, &count);
\r
95 + notmuch_rb_status_raise (status);
\r
97 + return UINT2NUM(count);
\r