Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 031F2431FAF for ; Mon, 23 Apr 2012 07:04:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7pVdRP1tC2ED for ; Mon, 23 Apr 2012 07:04:46 -0700 (PDT) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D608D431FAE for ; Mon, 23 Apr 2012 07:04:45 -0700 (PDT) Received: by bkcjm2 with SMTP id jm2so2098329bkc.26 for ; Mon, 23 Apr 2012 07:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=aPPfBs8sjhjRzpppRYKZ0CgbdTShcjf3mOXmxAh2aso=; b=ji4cApa19MYC404FS7wZOLuzRLWCiuLFcFLUuw9MwBVwp19WSuzazUMAdXxi/SA6zY q5+4dC/SkpTNlDFZFSMsa3JVMOKpgiO51o90bsGM60Oq321GTg3JHtp9V1alNLimCGZn 1sVXuvRmw4gKwPE9v3rway3MZO2WSFsBZYOjJc9pJFV8PIaNzD2IIdC824nusewAag1j ZQuBYsJVPlMmaNHvyCJBHrOFfeoBQYZdyPLwtl5U7c3Ckvne9ZnCmSp2l5laLvnjhLCS D+OmfMI9OqS1zwy/uvOp8I6DiwcN1Nhut/AuluschsL+u9gjWu7WdLtG5Gm3qWIvrj8C Zaag== MIME-Version: 1.0 Received: by 10.204.154.133 with SMTP id o5mr5146445bkw.100.1335189883129; Mon, 23 Apr 2012 07:04:43 -0700 (PDT) Sender: polatel@gmail.com Received: by 10.204.123.73 with HTTP; Mon, 23 Apr 2012 07:04:43 -0700 (PDT) In-Reply-To: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com> References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com> Date: Mon, 23 Apr 2012 17:04:43 +0300 X-Google-Sender-Auth: WwD-_Gj6-IaQEn68VdSYjc7dU0M Message-ID: Subject: Re: [PATCH] ruby: make sure the database is closed From: Ali Polatel To: Felipe Contreras Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Mon, 23 Apr 2012 14:04:47 -0000 2012/4/23 Felipe Contreras : > If the Ruby code does not manually close the database, we need to make > sure it's closed when garbage collected. > > In Ruby, users are not _required_ to close, the garbage collector should > take care of that. > > Signed-off-by: Felipe Contreras > --- > =A0bindings/ruby/database.c | =A0 =A08 +++++++- > =A01 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c > index 982fd59..7b2ed47 100644 > --- a/bindings/ruby/database.c > +++ b/bindings/ruby/database.c > @@ -20,10 +20,16 @@ > > =A0#include "defs.h" > > +static void > +database_free (void *p) > +{ > + =A0 =A0notmuch_database_close (p); > +} > + > =A0VALUE > =A0notmuch_rb_database_alloc (VALUE klass) > =A0{ > - =A0 =A0return Data_Wrap_Struct (klass, NULL, NULL, NULL); > + =A0 =A0return Data_Wrap_Struct (klass, NULL, database_free, NULL); > =A0} > > =A0/* > -- > 1.7.10 > I'd rather not do this. Please read: http://comments.gmane.org/gmane.comp.lang.ruby.general/320324 -alip