summaryrefslogtreecommitdiff
path: root/legacy/eobj
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-07-10 14:02:03 +0000
committerTom Hacohen <tom@stosb.com>2012-07-10 14:02:03 +0000
commitd19b9400999dee4af8e58818f8ff7192c399271c (patch)
treed1b051674be54116d850192febd6b5d567d4afb7 /legacy/eobj
parentb018d8cfcfaf36f43e217d8d51f1e5f631d3d261 (diff)
Eo: Avoid unneeded copies with kls-itr.
SVN revision: 73532
Diffstat (limited to 'legacy/eobj')
-rw-r--r--legacy/eobj/src/lib/eo.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/legacy/eobj/src/lib/eo.c b/legacy/eobj/src/lib/eo.c
index 242007cb58..e82030ba6c 100644
--- a/legacy/eobj/src/lib/eo.c
+++ b/legacy/eobj/src/lib/eo.c
@@ -26,6 +26,7 @@ static inline void _eo_unref(Eo *obj);
26typedef struct 26typedef struct
27{ 27{
28 const Eo_Class **kls_itr; 28 const Eo_Class **kls_itr;
29 Eina_Bool insuper_context:1;
29} Eo_Kls_Itr; 30} Eo_Kls_Itr;
30 31
31struct _Eo { 32struct _Eo {
@@ -239,14 +240,20 @@ _eo_op_id_name_get(Eo_Op op)
239static inline void 240static inline void
240_eo_kls_itr_init(const Eo_Class *obj_klass, Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state) 241_eo_kls_itr_init(const Eo_Class *obj_klass, Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state)
241{ 242{
242 prev_state->kls_itr = cur->kls_itr; 243 if (cur->insuper_context)
243 cur->kls_itr = obj_klass->mro; 244 {
245 memcpy(prev_state, cur, sizeof(*cur));
246 cur->kls_itr = obj_klass->mro;
247 }
244} 248}
245 249
246static inline void 250static inline void
247_eo_kls_itr_end(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state) 251_eo_kls_itr_end(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state)
248{ 252{
249 cur->kls_itr = prev_state->kls_itr; 253 if (cur->insuper_context)
254 {
255 memcpy(cur, prev_state, sizeof(*cur));
256 }
250} 257}
251 258
252static inline const Eo_Class * 259static inline const Eo_Class *
@@ -259,7 +266,8 @@ static inline const Eo_Class *
259_eo_kls_itr_next(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state, Eo_Op op) 266_eo_kls_itr_next(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state, Eo_Op op)
260{ 267{
261 const Eo_Class **kls_itr = cur->kls_itr; 268 const Eo_Class **kls_itr = cur->kls_itr;
262 prev_state->kls_itr = cur->kls_itr; 269 memcpy(prev_state, cur, sizeof(*cur));
270 cur->insuper_context = EINA_TRUE;
263 if (*kls_itr) 271 if (*kls_itr)
264 { 272 {
265 const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op); 273 const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op);