From 63eb9a28b3c24a20ff26f71886a5150b3d428ad2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 15 Feb 2017 15:25:15 +0900 Subject: [PATCH] eo_debug: Remove some abusive goto where not needed goto was used for micro-optimization. There is absolutely no need for those if we're using the slow path with eo_debug. Simplify the code. --- src/lib/eo/eo.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index a032e917c0..48d1d9d144 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -1964,24 +1964,22 @@ efl_data_scope_get(const Eo *obj_id, const Efl_Class *klass_id) EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL); EO_CLASS_POINTER_GOTO(klass_id, klass, err_klass); -#ifdef EO_DEBUG +#ifndef EO_DEBUG + ret = _efl_data_scope_safe_get(obj, klass); +#else if (_eo_class_mro_has(obj->klass, klass)) + { + ret = _efl_data_scope_safe_get(obj, klass); + if (!ret && (klass->desc->data_size == 0)) + ERR("Tried getting data of class '%s', but it has none.", klass->desc->name); + } + else + { + ERR("Tried getting data of class '%s' from object of class '%s', but the former is not a direct inheritance of the latter.", + klass->desc->name, obj->klass->desc->name); + } #endif - ret = _efl_data_scope_safe_get(obj, klass); -#ifdef EO_DEBUG - // rare to make it a goto to clear out instruction cache of rare code - else goto err_mro; - // rare to make it a goto to clear out instruction cache of rare code - if (!ret && (klass->desc->data_size == 0)) goto err_ret; - EO_OBJ_DONE(obj_id); - return ret; -err_ret: - ERR("Tried getting data of class '%s', but it has none.", klass->desc->name); - goto err_klass; -err_mro: - ERR("Tried getting data of class '%s' from object of class '%s', but the former is not a direct inheritance of the latter.", klass->desc->name, obj->klass->desc->name); -#endif err_klass: EO_OBJ_DONE(obj_id); return ret;