eo: Fix unnecessary ERR logs with eo_debug

efl_data_scope_safe_get() is often used to assert that an object is of a
certain type, but assuming it may be NULL or not of the required type.
This means that encountering an invalid type is an error handled by the
caller (we return NULL), and shouldn't print out extra ERR() logs.

This fixes issues with E run under eo_debug. E's code was safe as it's
using evas_object_smart_data_get() and verifies whether the returned
value is NULL (which is expected for a rectangle, for instance).

@fix
This commit is contained in:
Jean-Philippe Andre 2017-09-28 12:25:19 +09:00
parent 6bed255fc4
commit 902938f626
1 changed files with 9 additions and 9 deletions

View File

@ -2076,26 +2076,26 @@ err_klass:
EAPI void *
efl_data_scope_safe_get(const Eo *obj_id, const Efl_Class *klass_id)
{
#ifndef EO_DEBUG
void *ret = NULL;
if (!obj_id) return NULL;
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
EO_CLASS_POINTER_GOTO(klass_id, klass, err_klass);
if (obj->destructed)
{
goto err_klass;
}
if (obj->destructed) goto err_klass;
if (_eo_class_mro_has(obj->klass, klass))
ret = _efl_data_scope_safe_get(obj, klass);
{
ret = _efl_data_scope_safe_get(obj, klass);
#ifdef EO_DEBUG
if (!ret && (klass->desc->data_size == 0))
ERR("Tried getting data of class '%s', but it has none.", klass->desc->name);
#endif
}
err_klass:
EO_OBJ_DONE(obj_id);
return ret;
#else
return efl_data_scope_get(obj_id, klass_id);
#endif
}
EAPI void *