aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-01 11:08:34 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-01 11:32:43 +0100
commit32a2268f46f8e1c03c01b5bdb85217a9a19ee7e8 (patch)
tree3b04aed2cfba12fa8693ac4a68f50908bf7828d5
parentecore_imf: fix wrong sample code (diff)
downloadefl-32a2268f46f8e1c03c01b5bdb85217a9a19ee7e8.tar.gz
eo: fix efl_isa to work propertly with interfaces
mro only contains special interfaces, not in general all, in order to have a working function, while NOT having a bad performance. In order to achive that we just copy the code that is done on efl_isa for a object. which is a linear walk of a list ref https://phab.enlightenment.org/D7857 Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7860
-rw-r--r--src/lib/eo/eo.c16
-rw-r--r--src/tests/eo/interface/interface_main.c3
2 files changed, 6 insertions, 13 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 3e4ac6c3e5..8f711d8e4a 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1760,24 +1760,14 @@ efl_isa(const Eo *eo_id, const Efl_Class *klass_id)
// Case where we are looking if eo_id is a class that contain klass_id
if (EINA_UNLIKELY(_eo_is_a_class(eo_id)))
{
- const _Efl_Class **kls_itr;
EO_CLASS_POINTER_GOTO(klass_id, klass, err_class);
EO_CLASS_POINTER_GOTO(eo_id, lookinto, err_class0);
- if (lookinto == klass) return EINA_TRUE;
-
- kls_itr = lookinto->mro;
- if (!kls_itr) return EINA_FALSE;
-
- while (*kls_itr)
- {
- if ((*kls_itr) == klass)
- return EINA_TRUE;
- kls_itr++;
- }
+ const op_type_funcs *func = _vtable_func_get
+ (&lookinto->vtable, klass->base_id + klass->ops_count);
- return EINA_FALSE;
+ return (func && (func->func == _eo_class_isa_func));;
}
domain = ((Eo_Id)eo_id >> SHIFT_DOMAIN) & MASK_DOMAIN;
diff --git a/src/tests/eo/interface/interface_main.c b/src/tests/eo/interface/interface_main.c
index 53142cfd7f..ed56c9fa26 100644
--- a/src/tests/eo/interface/interface_main.c
+++ b/src/tests/eo/interface/interface_main.c
@@ -37,6 +37,9 @@ main(int argc, char *argv[])
fail_if(!efl_isa(obj, INTERFACE_CLASS));
fail_if(!efl_isa(obj, INTERFACE2_CLASS));
+ fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE_CLASS));
+ fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE2_CLASS));
+ fail_if(efl_isa(INTERFACE_CLASS, INTERFACE2_CLASS));
efl_unref(obj);
efl_object_shutdown();