eina: actually it make more sense to do the check for EINA_VALUE_EMPTY inside eina_value_type_get.

This commit is contained in:
Cedric BAIL 2018-05-07 09:46:42 -07:00
parent 2b489d5627
commit b8cf656bd3
2 changed files with 7 additions and 3 deletions

View File

@ -538,7 +538,12 @@ eina_value_pget(const Eina_Value *value, void *ptr)
static inline const Eina_Value_Type *
eina_value_type_get(const Eina_Value *value)
{
EINA_VALUE_TYPE_CHECK_RETURN_VAL(value, NULL);
const Eina_Value empty = EINA_VALUE_EMPTY;
EINA_SAFETY_ON_NULL_RETURN_VAL(value, NULL);
// Trigger warning if the type is NULL, but the value is != EINA_VALUE_EMTPY.
if (memcmp(value, &empty, sizeof (Eina_Value)))
EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_type_check(value->type), NULL);
return value->type;
}

View File

@ -644,8 +644,7 @@ _future_proxy(void *data, const Eina_Value v,
{
Eina_Value copy = EINA_VALUE_EMPTY;
if (memcmp(&copy, &v, sizeof (Eina_Value)) &&
eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR) return v;
if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR) return v;
//We're in a safe context (from mainloop), so we can avoid scheduling a new dispatch
if (!v.type || !memcmp(&v, &copy, sizeof (Eina_Value))) copy = v;
else if (!eina_value_copy(&v, &copy))