On Tue, Jan 20, 2009 at 1:44 PM, Enlightenment SVN
<[email protected]> wrote:
> Log:
> * eina/src/include/eina_private.h,
> * eina/src/lib/eina_array.c: Remove potential error detected by llvm
> in eina_array.
> #define MAGIC_FREE(ptr) \
> - do { \
> + if (ptr) { \
> EINA_MAGIC_SET(ptr, EINA_MAGIC_NONE); \
> FREE(ptr); \
> - } while(0);
> + }
you need do {} while(0) so you don't mess with outer "ifs", see
http://kernelnewbies.org/FAQ/DoWhile0
> -
> #endif /* EINA_PRIVATE_H_ */
>
>
> Modified: trunk/eina/src/lib/eina_array.c
> ===================================================================
> --- trunk/eina/src/lib/eina_array.c 2009-01-20 15:42:34 UTC (rev 38661)
> +++ trunk/eina/src/lib/eina_array.c 2009-01-20 15:44:52 UTC (rev 38662)
> @@ -94,6 +94,7 @@
> {
> EINA_MAGIC_CHECK_ARRAY_ITERATOR(it);
>
> + if (!it) return EINA_FALSE;
> if (!(it->index < eina_array_count_get(it->array)))
> return EINA_FALSE;
> if (data)
> @@ -106,7 +107,7 @@
> eina_array_iterator_get_container(Eina_Iterator_Array *it)
> {
> EINA_MAGIC_CHECK_ARRAY_ITERATOR(it);
> - return (Eina_Array *) it->array;
> + return it ? (Eina_Array *) it->array : NULL;
> }
these internal cases that are already guarded elsewhere should be
marked with EINA_ARGS_NONULL(). It is impossible to get a NULL
iterator there, since one uses the iterator to figure out the
callback. So please create a prototypes and mark them appropriately.
--
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel