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