eo: fix callback cmp

Summary:
as told in _eina_stringshared_key_cmp in eina_hash.c:

originally we want to do this:
   return key1 - key2;
but since they are ptrs and an int can't store the different of 2 ptrs in
either 32 or 64bit (signed hasn't got enough range for the diff of 2
32bit values regardless of their type... we'd need 33bits or 65bits)

So changing this to the same logic.

Reviewers: tasn, raster

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4298
This commit is contained in:
Marcel Hollerbach 2016-09-17 15:17:25 +02:00
parent 42b3bc1e8a
commit 907bbbf965
1 changed files with 3 additions and 1 deletions

View File

@ -2154,5 +2154,7 @@ efl_manual_free(Eo *obj_id)
EAPI int
efl_callbacks_cmp(const Efl_Callback_Array_Item *a, const Efl_Callback_Array_Item *b)
{
return (const unsigned char *) a->desc - (const unsigned char *) b->desc;
if (a->desc == b->desc) return 0;
else if (a->desc > b->desc) return 1;
else return -1;
}