From 5adb5bd5c894e95d8fc35a0868671fdac713f998 Mon Sep 17 00:00:00 2001 From: tasn Date: Tue, 10 Jul 2012 14:02:03 +0000 Subject: Eo: Avoid unneeded copies with kls-itr. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@73532 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/eo.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/eo.c b/src/lib/eo.c index 242007c..e82030b 100644 --- a/src/lib/eo.c +++ b/src/lib/eo.c @@ -26,6 +26,7 @@ static inline void _eo_unref(Eo *obj); typedef struct { const Eo_Class **kls_itr; + Eina_Bool insuper_context:1; } Eo_Kls_Itr; struct _Eo { @@ -239,14 +240,20 @@ _eo_op_id_name_get(Eo_Op op) static inline void _eo_kls_itr_init(const Eo_Class *obj_klass, Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state) { - prev_state->kls_itr = cur->kls_itr; - cur->kls_itr = obj_klass->mro; + if (cur->insuper_context) + { + memcpy(prev_state, cur, sizeof(*cur)); + cur->kls_itr = obj_klass->mro; + } } static inline void _eo_kls_itr_end(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state) { - cur->kls_itr = prev_state->kls_itr; + if (cur->insuper_context) + { + memcpy(cur, prev_state, sizeof(*cur)); + } } static inline const Eo_Class * @@ -259,7 +266,8 @@ static inline const Eo_Class * _eo_kls_itr_next(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state, Eo_Op op) { const Eo_Class **kls_itr = cur->kls_itr; - prev_state->kls_itr = cur->kls_itr; + memcpy(prev_state, cur, sizeof(*cur)); + cur->insuper_context = EINA_TRUE; if (*kls_itr) { const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op); -- cgit v1.2.3