On Fri, Apr 29, 2011 at 3:54 PM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> Eina refcount: Wrap EINA_REFCOUNT_UNREF with do {} while(0).
>  #define EINA_REFCOUNT_UNREF(Variable, Free_Callback) \
> -  if (--((Variable)->__refcount) == 0)              \
> -    Free_Callback(Variable);
> +   do                                                \
> +     {                                               \
> +        if (--((Variable)->__refcount) == 0)         \
> +           Free_Callback(Variable);                  \
> +     }                                               \
> +   while (0)

maybe think of a way to set Free_Callback automatically? Spread this
all around the code will be bad?

One clear way would be to waste some memory and hook
(Variable)->__refcount_free_cb, but that's a pointer per object and
not good. Other way is to somehow register based on classes.

The current way is too error prone IMO.


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to