[Patch v4 9/9] ruby: use new query_search API
authorDavid Bremner <david@tethera.net>
Sun, 27 Sep 2015 15:32:03 +0000 (12:32 +2100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:40 +0000 (14:49 -0700)
33/9b7adc9bc39226967531f198e7683581c28548 [new file with mode: 0644]

diff --git a/33/9b7adc9bc39226967531f198e7683581c28548 b/33/9b7adc9bc39226967531f198e7683581c28548
new file mode 100644 (file)
index 0000000..f992be1
--- /dev/null
@@ -0,0 +1,93 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 312BB6DE0274\r
+ for <notmuch@notmuchmail.org>; Sun, 27 Sep 2015 08:34:29 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.108\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.108 tagged_above=-999 required=5 tests=[AWL=0.108]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id WT0kDGxaax9O for <notmuch@notmuchmail.org>;\r
+ Sun, 27 Sep 2015 08:34:27 -0700 (PDT)\r
+Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 745966DE14F2\r
+ for <notmuch@notmuchmail.org>; Sun, 27 Sep 2015 08:34:27 -0700 (PDT)\r
+Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1ZgDxR-0008En-NC; Sun, 27 Sep 2015 15:33:45 +0000\r
+Received: (nullmailer pid 11947 invoked by uid 1000); Sun, 27 Sep 2015\r
+ 15:32:11 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v4 9/9] ruby: use new query_search API\r
+Date: Sun, 27 Sep 2015 12:32:03 -0300\r
+Message-Id: <1443367923-11867-10-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.5.3\r
+In-Reply-To: <1443367923-11867-1-git-send-email-david@tethera.net>\r
+References: <1443367923-11867-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 27 Sep 2015 15:34:29 -0000\r
+\r
+These changes should not be too surprising for users because the\r
+routines were already potentially throwing exceptions.\r
+---\r
+ bindings/ruby/query.c | 14 ++++++++------\r
+ 1 file changed, 8 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c\r
+index f87700a..8cbc73f 100644\r
+--- a/bindings/ruby/query.c\r
++++ b/bindings/ruby/query.c\r
+@@ -134,12 +134,13 @@ notmuch_rb_query_search_threads (VALUE self)\r
+ {\r
+     notmuch_query_t *query;\r
+     notmuch_threads_t *threads;\r
++    notmuch_status_t status;\r
\r
+     Data_Get_Notmuch_Query (self, query);\r
\r
+-    threads = notmuch_query_search_threads (query);\r
+-    if (!threads)\r
+-      rb_raise (notmuch_rb_eMemoryError, "Out of memory");\r
++    status = notmuch_query_search_threads_st (query, &threads);\r
++    if (status)\r
++      notmuch_rb_status_raise (status);\r
\r
+     return Data_Wrap_Struct (notmuch_rb_cThreads, NULL, NULL, threads);\r
+ }\r
+@@ -154,12 +155,13 @@ notmuch_rb_query_search_messages (VALUE self)\r
+ {\r
+     notmuch_query_t *query;\r
+     notmuch_messages_t *messages;\r
++    notmuch_status_t status;\r
\r
+     Data_Get_Notmuch_Query (self, query);\r
\r
+-    messages = notmuch_query_search_messages (query);\r
+-    if (!messages)\r
+-      rb_raise (notmuch_rb_eMemoryError, "Out of memory");\r
++    status = notmuch_query_search_messages_st (query, &messages);\r
++    if (status)\r
++      notmuch_rb_status_raise (status);\r
\r
+     return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);\r
+ }\r
+-- \r
+2.5.3\r
+\r