Hello,

On Thu, Jun 28, 2012 at 7:24 AM, Raphael Kubo da Costa
<[email protected]> wrote:
> I promise this one is not about FreeBSD.
>
> It looks like there isn't much consistency in the order of the
> boilerplate argument checks in Eina: some functions perform a magic
> check before using EINA_SAFETY_ON_NULL_RETURN or something similar,
> while others do the opposite (it also happens that some functions in a
> given module such as Eina_Hash sometimes perform a magic check first and
> other functions bail out on NULL first).
>
> Personally, I think the latter makes more sense (if you pass NULL you
> just perform a NOP), but even if the consensus is that doing magic
> checks first is correct the documentation and the code should be updated
> to make things consistent.
>
> Thoughts?

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.

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.
-- 
Cedric BAIL

------------------------------------------------------------------------------
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

Reply via email to