Re: Rethinking *_destroy()
[notmuch-archives.git] / 77 / 611c6b00baf70169ebb91b2bf7317eb0b4eba4
1 Return-Path: <bgamari.foss@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id D10A7431FD0\r
6         for <notmuch@notmuchmail.org>; Mon, 19 Sep 2011 15:08:28 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=unavailable\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 7lgB4l+649YM for <notmuch@notmuchmail.org>;\r
17         Mon, 19 Sep 2011 15:08:28 -0700 (PDT)\r
18 Received: from mail-qy0-f174.google.com (mail-qy0-f174.google.com\r
19         [209.85.216.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 9BFA8431FB6\r
22         for <notmuch@notmuchmail.org>; Mon, 19 Sep 2011 15:08:28 -0700 (PDT)\r
23 Received: by qyk30 with SMTP id 30so3082432qyk.5\r
24         for <notmuch@notmuchmail.org>; Mon, 19 Sep 2011 15:08:26 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type;\r
28         bh=oqVWSie3FLajSgHwJpSLiFkXhwqnimbp1emmtrVg6d8=;\r
29         b=ObDq3xRFEzEoC3YO/IeJ87Y2AP1s0K3GSv3/DRdhCWP51u3H3BzVTCtoWCR2oMMLYO\r
30         fCiouDHIuWcunvs6jQWm1mp/Tey3iivkJby8TCNyUybqEeUSb6m0dqDMI18kXgsgluVL\r
31         4k8ClyAlcIeMsrJTCzpKbv5tSk4GqXsMl698A=\r
32 Received: by 10.224.202.135 with SMTP id fe7mr10798qab.378.1316470106775;\r
33         Mon, 19 Sep 2011 15:08:26 -0700 (PDT)\r
34 Received: from localhost (pool-96-233-180-23.spfdma.east.verizon.net.\r
35         [96.233.180.23])\r
36         by mx.google.com with ESMTPS id hc5sm6238550qab.23.2011.09.19.15.08.24\r
37         (version=TLSv1/SSLv3 cipher=OTHER);\r
38         Mon, 19 Sep 2011 15:08:25 -0700 (PDT)\r
39 From: Ben Gamari <bgamari.foss@gmail.com>\r
40 To: notmuch <notmuch@notmuchmail.org>\r
41 Subject: Re: Rethinking *_destroy()\r
42 In-Reply-To: <87aaa0l1tc.fsf@gmail.com>\r
43 References: <87aaa0l1tc.fsf@gmail.com>\r
44 User-Agent: Notmuch/0.7-37-g5c3c7f6 (http://notmuchmail.org) Emacs/23.2.1\r
45         (x86_64-pc-linux-gnu)\r
46 Date: Mon, 19 Sep 2011 18:08:22 -0400\r
47 Message-ID: <87sjnsrxrd.fsf@gmail.com>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 Cc: Bertram Felgenhauer <bertram.felgenhauer@googlemail.com>,\r
51         Bart Massey <bart@cs.pdx.edu>, Austin Clements <amdragon@MIT.EDU>,\r
52         notmuch <notmuch@notmuchmail.org>\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Mon, 19 Sep 2011 22:08:29 -0000\r
66 \r
67 On Mon, 19 Sep 2011 16:22:39 -0400, Ben Gamari <bgamari.foss@gmail.com> wrote:\r
68 > I can see at least two ways of doing this,\r
69\r
70 >   1) Acknowledging that we use talloc and allowing users to use\r
71 >      talloc_ref and talloc_unlink directly\r
72\r
73 >   2) Wrapping talloc by adding a *_ref() and *_unref() to each object\r
74\r
75 I should not that these aren't quite as trivial as they sound. As I\r
76 neglect to mention in this message, we currently use talloc_free in\r
77 *_destroy(). As of talloc-2.0, talloc_free() fails on objects with more\r
78 than one parent. When we allow library users to add their own references\r
79 to notmuch objects, this assumption will break. Sorry for the confusion,\r
80 \r
81 Cheers,\r
82 \r
83 - Ben\r