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 D10A7431FD0 for ; Mon, 19 Sep 2011 15:08:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=unavailable 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 7lgB4l+649YM for ; Mon, 19 Sep 2011 15:08:28 -0700 (PDT) Received: from mail-qy0-f174.google.com (mail-qy0-f174.google.com [209.85.216.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9BFA8431FB6 for ; Mon, 19 Sep 2011 15:08:28 -0700 (PDT) Received: by qyk30 with SMTP id 30so3082432qyk.5 for ; Mon, 19 Sep 2011 15:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=oqVWSie3FLajSgHwJpSLiFkXhwqnimbp1emmtrVg6d8=; b=ObDq3xRFEzEoC3YO/IeJ87Y2AP1s0K3GSv3/DRdhCWP51u3H3BzVTCtoWCR2oMMLYO fCiouDHIuWcunvs6jQWm1mp/Tey3iivkJby8TCNyUybqEeUSb6m0dqDMI18kXgsgluVL 4k8ClyAlcIeMsrJTCzpKbv5tSk4GqXsMl698A= Received: by 10.224.202.135 with SMTP id fe7mr10798qab.378.1316470106775; Mon, 19 Sep 2011 15:08:26 -0700 (PDT) Received: from localhost (pool-96-233-180-23.spfdma.east.verizon.net. [96.233.180.23]) by mx.google.com with ESMTPS id hc5sm6238550qab.23.2011.09.19.15.08.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Sep 2011 15:08:25 -0700 (PDT) From: Ben Gamari To: notmuch Subject: Re: Rethinking *_destroy() In-Reply-To: <87aaa0l1tc.fsf@gmail.com> References: <87aaa0l1tc.fsf@gmail.com> User-Agent: Notmuch/0.7-37-g5c3c7f6 (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Mon, 19 Sep 2011 18:08:22 -0400 Message-ID: <87sjnsrxrd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Bertram Felgenhauer , Bart Massey , Austin Clements , notmuch 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, 19 Sep 2011 22:08:29 -0000 On Mon, 19 Sep 2011 16:22:39 -0400, Ben Gamari wrote: > I can see at least two ways of doing this, > > 1) Acknowledging that we use talloc and allowing users to use > talloc_ref and talloc_unlink directly > > 2) Wrapping talloc by adding a *_ref() and *_unref() to each object > I should not that these aren't quite as trivial as they sound. As I neglect to mention in this message, we currently use talloc_free in *_destroy(). As of talloc-2.0, talloc_free() fails on objects with more than one parent. When we allow library users to add their own references to notmuch objects, this assumption will break. Sorry for the confusion, Cheers, - Ben