From 902938f626adde50c7b14a800e87c92a79f72a78 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 28 Sep 2017 12:25:19 +0900 Subject: [PATCH] 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 --- src/lib/eo/eo.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 5e75cf9d01..49dc221aee 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -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 *