Re: cbdataFree

From: Adrian Chadd <adrian@dont-contact.us>
Date: Mon, 7 May 2001 20:31:08 +0800

On Mon, May 07, 2001, Robert Collins wrote:
> This macro:
>
> #define cbdataFree(var) (var = (var != NULL ? cbdataInternalFree(var):
> NULL))
>
> is a problem for me:
> I'm build a refcounted structure.
> the cbdata code has provision to allow the following sequence:
>
> CBDATA_INIT_TYPE_FREECB(footype, freefoo)
>
> foo=cbdataAlloc(footype);
> cbdataLock(foo);
> cbdataFree(foo);

At this point in time you can't use foo anymore.
It is marked "invalid".

> access, lock and unlock foo until a matching
> cbdataUnlock(foo);
> occurs and then freefoo(foo) is automatically called.
>
> However the above macro is setting foo to NULL !? (because
> cbdataInternalFree is returning NULL).
>
> Is this by design or oversite?

Design. :-)

What exactly are you trying to do?

Adrian

-- 
Adrian Chadd			"How could we possibly use sex to get
<adrian@creative.net.au>	  what we want?
			 	   Sex _IS_ what we want!" -- Fraser
Received on Mon May 07 2001 - 06:36:05 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:00 MST