summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortasn <tasn>2012-07-10 14:02:03 +0000
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2012-07-10 14:02:03 +0000
commit5adb5bd5c894e95d8fc35a0868671fdac713f998 (patch)
treeedd3e8644e7bb1a189054623b31803da7d7f59c4 /src
parent02c6fd3422886682899b92fbf08c2ce52993397b (diff)
downloadeobj-5adb5bd5c894e95d8fc35a0868671fdac713f998.tar.gz
eobj-5adb5bd5c894e95d8fc35a0868671fdac713f998.tar.bz2
eobj-5adb5bd5c894e95d8fc35a0868671fdac713f998.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/eo.c16
1 files changed, 12 insertions, 4 deletions
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);