forked from enlightenment/efl
Eo: Move op resolve check to where it belongs (out of hot path).
It was put in the wrong place. It should abort early if it detects we can't resolve, and shouldn't check it if we already know it's OK.
This commit is contained in:
parent
9686e44b92
commit
f28f6ecbfa
|
@ -484,8 +484,11 @@ typedef struct _Eo_Call_Cache
|
|||
#define EO_FUNC_COMMON_OP(Name, DefRet) \
|
||||
static Eo_Call_Cache ___cache; /* static 0 by default */ \
|
||||
Eo_Op_Call_Data ___call; \
|
||||
if (___cache.op == EO_NOOP) \
|
||||
___cache.op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
|
||||
if (EINA_UNLIKELY(___cache.op == EO_NOOP)) \
|
||||
{ \
|
||||
___cache.op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
|
||||
if (___cache.op == EO_NOOP) return DefRet; \
|
||||
} \
|
||||
if (!_eo_call_resolve(#Name, &___call, &___cache, \
|
||||
__FILE__, __LINE__)) return DefRet; \
|
||||
_Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func; \
|
||||
|
|
|
@ -743,6 +743,11 @@ _eo_api_op_id_get(const void *api_func)
|
|||
#endif
|
||||
eina_spinlock_release(&_ops_storage_lock);
|
||||
|
||||
if (op == EO_NOOP)
|
||||
{
|
||||
ERR("Unable to resolve op for api func %p", api_func);
|
||||
}
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ START_TEST(eo_api_not_implemented_call)
|
|||
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
|
||||
fail_if(!obj);
|
||||
|
||||
TEST_EO_ERROR("_eo_call_resolve", "%s:%d: unable to resolve %s api func '%s' in class '%s'.");
|
||||
TEST_EO_ERROR("_eo_api_op_id_get", "Unable to resolve op for api func %p");
|
||||
eo_do(obj, simple_no_implementation());
|
||||
fail_unless(ctx.did);
|
||||
|
||||
|
|
Loading…
Reference in New Issue