diff options
author | Tom Hacohen <tom@stosb.com> | 2013-11-11 13:06:51 +0000 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-01-03 16:22:20 +0100 |
commit | 0f010df67cfa70b0d545e72f7f18e7f14b5e4e78 (patch) | |
tree | 6894f1c11f4277dfdbf5fb1b1a125ac1a86b96c8 | |
parent | 3388bc3414e1c5c9156b72b99bc38943b7e6f9bf (diff) | |
download | efl-0f010df67cfa70b0d545e72f7f18e7f14b5e4e78.tar.gz |
eo2: optimize eo2_do_super func relove a bit.
no need to call dich_func_get twice, just reuse the value previously
fetched.
-rw-r--r-- | src/lib/eo/eo.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index fc8abc303f..59e4b77d59 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -209,8 +209,8 @@ _eo_op_id_name_get(Eo_Op op) return (desc) ? desc->name : NULL; } -static inline const _Eo_Class * -_eo_kls_itr_next(const _Eo_Class *orig_kls, const _Eo_Class *cur_klass, Eo_Op op) +static inline const op_type_funcs * +_eo2_kls_itr_next(const _Eo_Class *orig_kls, const _Eo_Class *cur_klass, Eo_Op op) { const _Eo_Class **kls_itr = NULL; @@ -230,13 +230,22 @@ _eo_kls_itr_next(const _Eo_Class *orig_kls, const _Eo_Class *cur_klass, Eo_Op op kls_itr++; continue; } - return fsrc->src; + return fsrc; } } return NULL; } +static inline const _Eo_Class * +_eo_kls_itr_next(const _Eo_Class *orig_kls, const _Eo_Class *cur_klass, Eo_Op op) +{ + const op_type_funcs *fsrc; + fsrc = _eo2_kls_itr_next(orig_kls, cur_klass, op); + + return (fsrc) ? fsrc->src : NULL; +} + static inline const op_type_funcs * _eo_kls_itr_func_get(const _Eo_Class *cur_klass, Eo_Op op) { @@ -259,22 +268,6 @@ _eo_kls_itr_func_get(const _Eo_Class *cur_klass, Eo_Op op) EAPI Eo2_Hook_Call eo2_hook_call_pre = NULL; EAPI Eo2_Hook_Call eo2_hook_call_post = NULL; -static inline const _Eo_Class * -_eo2_kls_itr_next(const _Eo_Class *orig_kls, const _Eo_Class *cur_klass) -{ - const _Eo_Class **kls_itr = NULL; - - /* Find the kls itr. */ - kls_itr = orig_kls->mro; - while (*kls_itr && (*kls_itr != cur_klass)) - kls_itr++; - - if (*kls_itr) - return *(++kls_itr); - - return NULL; -} - // FIXME: per thread stack, grow/shrink #define EO2_INVALID_DATA (void *) -1 #define EO2_CALL_STACK_DEPTH 100 @@ -417,14 +410,18 @@ _eo2_call_resolve(const char *func_name, const Eo_Op op, Eo2_Op_Call_Data *call) /* If we have a current class, we need to itr to the next. */ if (fptr->cur_klass) { - /* FIXME-2 This should actually be merged with the dich_func_get after. */ - klass = _eo_kls_itr_next(klass, fptr->cur_klass, op); + func = _eo2_kls_itr_next(klass, fptr->cur_klass, op); - if (!klass) + if (!func) goto end; + + klass = func->src; + } + else + { + func = _dich_func_get(klass, op); } - func = _dich_func_get(klass, op); if (EINA_UNLIKELY(func == NULL)) { ERR("you called func '%s' (%d) which is unknown in class '%s'", func_name, op, klass->desc->name); |