Cedric BAIL <[email protected]> writes: > Could you please give us the name of the function that you think do it > wrong ? Because I will take an example as it will make this easier to > understand.
I started thinking about this because of a patch [1] in which someone is checking if a given Eina_Iterator* is NULL and not calling eina_iterator_free() in that case to avoid getting a (supposedly needless) SPANK SPANK message -- eina_iterator_free(), contrary to free(), complains if NULL is passed to it (and its documentation does not say anything about that). > Looking at eina_hash_free_cb_set for example, we indeed check first > for magic then do a safety NULL return. The reason is that this > function is marked as EINA_ARG_NONNULL(1). This mean it should never > receive a NULL call, but we do put safety code to avoid any problem. > So we first warn the user that he did something wrong with the magic > check, and if the magic check are disable for speed reason, we still > have the safety check to prevent thing to go really wrong. This means > that in on a really limited hardware, we should be able to disable > safety check and magic check and your program should still continue to > run nicely. Indeed, eina_iterator_free() is marked with EINA_ARG_NONNULL; in this case, I wonder if such functions should really complain loudly instead of simply doing nothing when NULL is passed (after all, shouldn't the EINA_ARG_NONNULL decorator + some good documentation be enough?); furthermore, there are functions such as eina_hash_free() and eina_hash_population() which are marked with EINA_ARG_NONNULL but still perform NULL checks before magic checks. [1] https://bugs.webkit.org/show_bug.cgi?id=90076 ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
