news and changelog

On Wed, Sep 5, 2012 at 12:20 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> eina: Fix EINA_INLIST_FOREACH_SAFE macro
>
>   EINA_INLIST_FOREACH_SAFE is very broken and it only works by luck, 
> depending on
>   the __inlist field being the first one in the struct. Until now.
>
>   This commit makes the following snippet to work:
>
>
>         #include <Eina.h>
>
>         typedef struct _data {
>            char *name;
>            EINA_INLIST;
>         } data;
>
>         int
>         main()
>         {
>            Eina_Inlist *inlist = NULL, *inlist_safe;
>            data *reg, *d;
>
>            reg = malloc(sizeof(data));
>            inlist = eina_inlist_append(inlist, EINA_INLIST_GET(reg));
>
>            EINA_INLIST_FOREACH_SAFE(inlist, inlist_safe, d)
>              {
>                 printf("%p\n", d);
>                 inlist = eina_inlist_remove(inlist, EINA_INLIST_GET(d));
>                 free(d);
>              }
>
>            return 0;
>         }
>
>
>    Patch-by: Jos?\195?\169 Roberto de Souza <zehortig...@profusion.mobi>
>
>
>
> Author:       lucas
> Date:         2012-09-04 15:20:25 -0700 (Tue, 04 Sep 2012)
> New Revision: 76150
> Trac:         http://trac.enlightenment.org/e/changeset/76150
>
> Modified:
>   trunk/eina/src/include/eina_inlist.h
>
> Modified: trunk/eina/src/include/eina_inlist.h
> ===================================================================
> --- trunk/eina/src/include/eina_inlist.h        2012-09-04 21:43:32 UTC (rev 
> 76149)
> +++ trunk/eina/src/include/eina_inlist.h        2012-09-04 22:20:25 UTC (rev 
> 76150)
> @@ -803,7 +803,7 @@
>  #define EINA_INLIST_FOREACH_SAFE(list, list2, l) \
>     for (l = (list ? _EINA_INLIST_CONTAINER(l, list) : NULL), list2 = l ? 
> ((EINA_INLIST_GET(l) ? EINA_INLIST_GET(l)->next : NULL)) : NULL; \
>          l; \
> -        l = _EINA_INLIST_CONTAINER(l, list2), list2 = list2 ? list2->next : 
> NULL)
> +        l = list2 ? _EINA_INLIST_CONTAINER(l, list2) : NULL, list2 = list2 ? 
> list2->next : NULL)
>  /**
>   * @def EINA_INLIST_REVERSE_FOREACH
>   * @param list The list to be reversed.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to