summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-18 14:04:59 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-24 16:29:25 -0800
commit549bf6e2696e9d1d52cfd365397a98511b82f92b (patch)
treea08217c006684296e9eadf6bbf8dd96827321f73 /src/lib/eo/eo.c
parent87c5ffda588c348416f6a52029cdad8fe192c4f5 (diff)
eo: improve efl_isa to be able to know if a class is part of the hierarchy of another class.
Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7703
Diffstat (limited to 'src/lib/eo/eo.c')
-rw-r--r--src/lib/eo/eo.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 5d95ff0..44a17ae 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1756,6 +1756,30 @@ efl_isa(const Eo *eo_id, const Efl_Class *klass_id)
1756 Eina_Bool isa = EINA_FALSE; 1756 Eina_Bool isa = EINA_FALSE;
1757 1757
1758 if (EINA_UNLIKELY(!eo_id)) return EINA_FALSE; 1758 if (EINA_UNLIKELY(!eo_id)) return EINA_FALSE;
1759
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)))
1762 {
1763 const _Efl_Class **kls_itr;
1764
1765 EO_CLASS_POINTER_GOTO(klass_id, klass, err_class);
1766 EO_CLASS_POINTER_GOTO(eo_id, lookinto, err_class0);
1767
1768 if (lookinto == klass) return EINA_TRUE;
1769
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
1780 return EINA_FALSE;
1781 }
1782
1759 domain = ((Eo_Id)eo_id >> SHIFT_DOMAIN) & MASK_DOMAIN; 1783 domain = ((Eo_Id)eo_id >> SHIFT_DOMAIN) & MASK_DOMAIN;
1760 data = _eo_table_data_get(); 1784 data = _eo_table_data_get();
1761 tdata = _eo_table_data_table_get(data, domain); 1785 tdata = _eo_table_data_table_get(data, domain);
@@ -1821,6 +1845,10 @@ err_shared_obj: EINA_COLD
1821 eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); 1845 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
1822 return EINA_FALSE; 1846 return EINA_FALSE;
1823 1847
1848err_class0:
1849 _EO_POINTER_ERR(eo_id, "Class (%p) is an invalid ref.", eo_id);
1850 return EINA_FALSE;
1851
1824err_class: EINA_COLD 1852err_class: EINA_COLD
1825 _EO_POINTER_ERR(klass_id, "Class (%p) is an invalid ref.", klass_id); 1853 _EO_POINTER_ERR(klass_id, "Class (%p) is an invalid ref.", klass_id);
1826err_obj: 1854err_obj: