summaryrefslogtreecommitdiff
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
parent0f40a43e531bd9ac6403636f91aff3b56ed5e008 (diff)
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 D7857 Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7860
Diffstat (limited to '')
-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)
1760 // Case where we are looking if eo_id is a class that contain klass_id 1760 // Case where we are looking if eo_id is a class that contain klass_id
1761 if (EINA_UNLIKELY(_eo_is_a_class(eo_id))) 1761 if (EINA_UNLIKELY(_eo_is_a_class(eo_id)))
1762 { 1762 {
1763 const _Efl_Class **kls_itr;
1764 1763
1765 EO_CLASS_POINTER_GOTO(klass_id, klass, err_class); 1764 EO_CLASS_POINTER_GOTO(klass_id, klass, err_class);
1766 EO_CLASS_POINTER_GOTO(eo_id, lookinto, err_class0); 1765 EO_CLASS_POINTER_GOTO(eo_id, lookinto, err_class0);
1767 1766
1768 if (lookinto == klass) return EINA_TRUE; 1767 const op_type_funcs *func = _vtable_func_get
1769 1768 (&lookinto->vtable, klass->base_id + klass->ops_count);
1770 kls_itr = lookinto->mro;
1771 if (!kls_itr) return EINA_FALSE;
1772
1773 while (*kls_itr)
1774 {
1775 if ((*kls_itr) == klass)
1776 return EINA_TRUE;
1777 kls_itr++;
1778 }
1779 1769
1780 return EINA_FALSE; 1770 return (func && (func->func == _eo_class_isa_func));;
1781 } 1771 }
1782 1772
1783 domain = ((Eo_Id)eo_id >> SHIFT_DOMAIN) & MASK_DOMAIN; 1773 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[])
37 37
38 fail_if(!efl_isa(obj, INTERFACE_CLASS)); 38 fail_if(!efl_isa(obj, INTERFACE_CLASS));
39 fail_if(!efl_isa(obj, INTERFACE2_CLASS)); 39 fail_if(!efl_isa(obj, INTERFACE2_CLASS));
40 fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE_CLASS));
41 fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE2_CLASS));
42 fail_if(efl_isa(INTERFACE_CLASS, INTERFACE2_CLASS));
40 43
41 efl_unref(obj); 44 efl_unref(obj);
42 efl_object_shutdown(); 45 efl_object_shutdown();