Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 5413 invoked from network); 7 Jun 2006 11:25:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jun 2006 11:25:31 -0000 Received: (qmail 34760 invoked by uid 500); 7 Jun 2006 11:25:31 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 34479 invoked by uid 500); 7 Jun 2006 11:25:30 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 34468 invoked by uid 99); 7 Jun 2006 11:25:30 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2006 04:25:30 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of bojan@rexursive.com designates 203.171.74.242 as permitted sender) Received: from [203.171.74.242] (HELO beauty.rexursive.com) (203.171.74.242) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2006 04:25:29 -0700 Received: from coyote.rexursive.com (coyote.rexursive.com [172.27.0.22]) by beauty.rexursive.com (Postfix) with ESMTP id 07C162548DE for ; Wed, 7 Jun 2006 21:25:08 +1000 (EST) Subject: Re: svn commit: r412252 - /apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c From: Bojan Smojver To: dev@apr.apache.org In-Reply-To: <1149678173.2889.2.camel@coyote.rexursive.com> References: <20060607020444.6C33C1A983A@eris.apache.org> <20060607085603.GB17796@redhat.com> <1149678173.2889.2.camel@coyote.rexursive.com> Content-Type: multipart/mixed; boundary="=-JbPzzqtZrJmz85ZZ1bjo" Date: Wed, 07 Jun 2006 21:25:07 +1000 Message-Id: <1149679507.2889.6.camel@coyote.rexursive.com> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.1) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --=-JbPzzqtZrJmz85ZZ1bjo Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2006-06-07 at 21:02 +1000, Bojan Smojver wrote: > I noticed these casts in other cleanup registrations, so I just assumed > they were safe. What did you have in mind? A wrapper function? Like this? -- Bojan --=-JbPzzqtZrJmz85ZZ1bjo Content-Disposition: attachment; filename=apr_dbd-sqlite2-cast.patch Content-Type: text/x-patch; name=apr_dbd-sqlite2-cast.patch; charset=utf-8 Content-Transfer-Encoding: 7bit Index: dbd/apr_dbd_sqlite2.c =================================================================== --- dbd/apr_dbd_sqlite2.c (revision 412365) +++ dbd/apr_dbd_sqlite2.c (working copy) @@ -67,6 +67,11 @@ } \ } while(0); +static apr_status_t free_table(void *data) +{ + sqlite_free_table(data); + return APR_SUCCESS; +} static int dbd_sqlite_select(apr_pool_t * pool, apr_dbd_t * sql, apr_dbd_results_t ** results, const char *query, @@ -97,7 +102,7 @@ (*results)->random = seek; if (tuples > 0) - apr_pool_cleanup_register(pool, result, (void *) sqlite_free_table, + apr_pool_cleanup_register(pool, result, free_table, apr_pool_cleanup_null); ret = 0; @@ -216,11 +221,17 @@ return ret; } +static apr_status_t free_mem(void *data) +{ + sqlite_freemem(data); + return APR_SUCCESS +} + static const char *dbd_sqlite_escape(apr_pool_t * pool, const char *arg, apr_dbd_t * sql) { char *ret = sqlite_mprintf("%q", arg); - apr_pool_cleanup_register(pool, ret, (void *) sqlite_freemem, + apr_pool_cleanup_register(pool, ret, free_mem, apr_pool_cleanup_null); return ret; } --=-JbPzzqtZrJmz85ZZ1bjo--