From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oArBG20j5WBVHQAAgWs5BA (envelope-from ) for ; Wed, 07 Jul 2021 05:45:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SHFwF20j5WAlaAAAbx9fmQ (envelope-from ) for ; Wed, 07 Jul 2021 03:45:49 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4F58D188C3 for ; Wed, 7 Jul 2021 05:45:48 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 614DC290DF; Tue, 6 Jul 2021 23:45:41 -0400 (EDT) Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by mail.notmuchmail.org (Postfix) with ESMTPS id 1C117290D8 for ; Tue, 6 Jul 2021 23:45:38 -0400 (EDT) Received: by mail-oi1-x22d.google.com with SMTP id u11so1884317oiv.1 for ; Tue, 06 Jul 2021 20:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PzeZrklY877VIRpG+4nArfJMm9Nq/EGDrz2IZDt24QU=; b=vG4fVfOfK2EVkuggrX7JdSgc20H6ZTdxG9KSD6KyGnHTiL/6N07NDGSNaz3/TyhMJn fTniLlAWgrGqme080X2z6WvMIrSazlLKH2a1AmA81qNzV3+sMUIPHhKtGJXidJGUlRpD +zWFcFFL5Pf4Js+C4qSCvOorISh9I5ntULkLe0no10acMAZ/AztUCy5zxceh9fPnaQQt Z+Naois4IidP86dCrWrpkIqY5EfdKMSNeb1iSZOnIChlra6VmURSvh8NgsmgECetJw3J u1zrZSYaUEPWiBBZoqsqE19kYOyvpqGHmCzGgdnt+IETiCDYeSLKabmI9bvLYpF78Tqq ZYuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PzeZrklY877VIRpG+4nArfJMm9Nq/EGDrz2IZDt24QU=; b=INCXy5Ensx7YkXYzZqrlbI857dlN1rU5+6DcGnGKLjAibG0hS/Di4OBZIzDsr2w1zg GPwW0Pwy2eCuziJWW21Dff/GSkD43AvL0XNGlzvDdkfgYaz4OUn5P/Y+COx9Ju6kP6l5 p+Qwy8mpdXJZenXUPOrlNEtZua6nyNKnAaNIemNeEzhBuG4Y49omdnHknDNP+FjV74Gm YFjZaoRoVTWrxyf1yHApfellTo9OMgkHwkYh4OODfeJcGdFosWyQTX3GeIneX/lYpIXQ w5xjQi0uMthgnVdqR0SHoJBIv3cj24zD6wh/5+hbGp+4D8mUkMSFpgtmS36s+8yCXUmW QaZQ== X-Gm-Message-State: AOAM530hhBqSbpjAiSfOKFYrFmIK9iTvoKj3aSuAaJ/SOZv4LdPmAne1 90VJymNUXoDl4nO3MaKE/QGzD4We2xM= X-Google-Smtp-Source: ABdhPJziF3RzemBsb4aMtq8zN1ar9r6ayeehROXNY2mQ2c1tJ4nLyXX4TYqLrefCVaNNRcIoiUtW3Q== X-Received: by 2002:aca:1b0c:: with SMTP id b12mr17131916oib.55.1625629537220; Tue, 06 Jul 2021 20:45:37 -0700 (PDT) Received: from localhost (fixed-187-189-163-231.totalplay.net. [187.189.163.231]) by smtp.gmail.com with ESMTPSA id b16sm1475668oic.5.2021.07.06.20.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 20:45:36 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Cc: David Bremner , Felipe Contreras Subject: [PATCH 1/2] ruby: split database close and destroy Date: Tue, 6 Jul 2021 22:45:32 -0500 Message-Id: <20210707034533.3137309-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.36.g70aac2b1aa In-Reply-To: <20210707034533.3137309-1-felipe.contreras@gmail.com> References: <20210707034533.3137309-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Message-ID-Hash: CFE3CDGU27KYWJK5SKL45XY2FBRUWYAN X-Message-ID-Hash: CFE3CDGU27KYWJK5SKL45XY2FBRUWYAN X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625629548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=O/gQGT+VB2w0BKVTj3EYNROHsVLM5riYkcjEdxkKwOs=; b=h6q2gzuwfJiw/I+Fb9SpjWQjAGehaeeq01Uc3/ApTe771gd73Aj0A1tjb18DlcS//LY2OD Yiir3aPYeMPSrt2UhHcNUYo8hhg/Bjmd1jyYVhuW1ODzwGWzQOhlZqSY6MY28zkmfFUGzD h0/gC5ohz7xcl785euK3jg5V/mqpmNjKVgCnheDSa0nWChDvqKzF47u4UFon3fnJ/f1cpI dADtcyToixoWCQ0vrwp0CXsCuiRUCooap04HpjMsGWZVs5RLXHC/0OgVXhCSCGoA2AjUcK hWJzLwQjFMDlbAawv0Jcw4rzAipHn7+PfFNzFItXeABe8VJMq3pSiu5Cd/31Cg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625629548; a=rsa-sha256; cv=none; b=YHw6PhtNKTHhIRqmf8Hvi2nDeKLP8dHXUq2Z354/1OGS8Wq9dRDlLnc0zN+42n23Zekrxc r0jcviXhmj0LEmROIScpwHwZzIqPJU0XE7YPv7DMN2fxTvspWYFWh9tA6Eve7bNpixb8Q9 i8AQcV1fBtmAltZamSjwZBTBL0GeBRcsDggT9p9j9h6ISJKH+HHgFxlvCiIYHNUZOeqWz7 xit3sufo8xwxO8l62dVkyrGIJ8Jh7nzfDJkUAZlXzkXHrzRt7LkuNBCO1NPxknLH1sDNGq OKFVMaf0CJJAMdmkluhRknd1Gs/9zyL2ylsSO9o8Y3Lex8vDzGmKzlrXffuBCw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=vG4fVfOf; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.94 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=vG4fVfOf; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 4F58D188C3 X-Spam-Score: -0.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: WY3xjq+SiSkI Mirrors the C API: 7864350c (Split notmuch_database_close into two functions, 2012-04-25). Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 19 ++++++++++++++++++- bindings/ruby/defs.h | 3 +++ bindings/ruby/init.c | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index d6c804ac..1828dc91 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -26,6 +26,19 @@ notmuch_rb_database_alloc (VALUE klass) return Data_Wrap_Notmuch_Object (klass, ¬much_rb_database_type, NULL); } +/* + * call-seq: DB.destroy => nil + * + * Destroys the database, freeing all resources allocated for it. + */ +VALUE +notmuch_rb_database_destroy (VALUE self) +{ + notmuch_rb_object_destroy (self, ¬much_rb_database_type); + + return Qnil; +} + /* * call-seq: Notmuch::Database.new(path [, {:create => false, :mode => Notmuch::MODE_READ_ONLY}]) => DB * @@ -113,8 +126,12 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass) VALUE notmuch_rb_database_close (VALUE self) { + notmuch_database_t *db; notmuch_status_t ret; - ret = notmuch_rb_object_destroy (self, ¬much_rb_database_type); + + Data_Get_Notmuch_Database (self, db); + + ret = notmuch_database_close (db); notmuch_rb_status_raise (ret); return Qnil; diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index 995bcafd..daac13ab 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -128,6 +128,9 @@ notmuch_rb_status_raise (notmuch_status_t status); VALUE notmuch_rb_database_alloc (VALUE klass); +VALUE +notmuch_rb_database_destroy (VALUE self); + VALUE notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE klass); diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index d421c601..87f99040 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -260,6 +260,7 @@ Init_notmuch (void) rb_define_alloc_func (notmuch_rb_cDatabase, notmuch_rb_database_alloc); rb_define_singleton_method (notmuch_rb_cDatabase, "open", notmuch_rb_database_open, -1); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "initialize", notmuch_rb_database_initialize, -1); /* in database.c */ + rb_define_method (notmuch_rb_cDatabase, "destroy!", notmuch_rb_database_destroy, 0); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "close", notmuch_rb_database_close, 0); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "path", notmuch_rb_database_path, 0); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "version", notmuch_rb_database_version, 0); /* in database.c */ -- 2.32.0.36.g70aac2b1aa