From 11595dc40c7a4a01e97f4c75a660f7730616473c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 8 Nov 2013 00:42:42 +0100 Subject: [PATCH] eo2: fix mixim elaboration a mixin class must not inherit - _eo2_api_desc_get() accept NULL klass param EO_CLASS_TYPE_REGULAR_NO_INSTANT is an acceptable extension class type for - _eo2_class_funcs_set() do not shout if parent is NULL --- src/lib/eo/eo.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 6a69c14..9688662 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -533,26 +533,29 @@ _eo2_api_desc_get(const void *api_func, const _Eo_Class *klass, const _Eo_Class const Eo2_Op_Description *op_desc; const Eo2_Op_Description *op_descs; - for (kls_itr = klass->mro ; *kls_itr ; kls_itr++) + if (klass) { - cur_klass = *kls_itr; - imin = 0; - imax = cur_klass->desc->ops.count - 1; - op_descs = cur_klass->desc->ops.descs2; - - while (imax >= imin) + for (kls_itr = klass->mro ; *kls_itr ; kls_itr++) { - imid = (imax + imin) / 2; - op_desc = op_descs + imid; + cur_klass = *kls_itr; + imin = 0; + imax = cur_klass->desc->ops.count - 1; + op_descs = cur_klass->desc->ops.descs2; - if (op_desc->api_func > api_func) - imin = imid + 1; - else if (op_desc->api_func < api_func) - imax = imid - 1; - else - return op_desc; - } + while (imax >= imin) + { + imid = (imax + imin) / 2; + op_desc = op_descs + imid; + + if (op_desc->api_func > api_func) + imin = imid + 1; + else if (op_desc->api_func < api_func) + imax = imid - 1; + else + return op_desc; + } + } } if (extns) @@ -560,7 +563,8 @@ _eo2_api_desc_get(const void *api_func, const _Eo_Class *klass, const _Eo_Class for (kls_itr = extns ; *kls_itr ; kls_itr++) { cur_klass = *kls_itr; - if (cur_klass->desc->type == EO_CLASS_TYPE_REGULAR) + if (cur_klass->desc->type == EO_CLASS_TYPE_REGULAR + || cur_klass->desc->type == EO_CLASS_TYPE_REGULAR_NO_INSTANT) { op_desc = _eo2_api_desc_get(api_func, cur_klass, NULL); if (op_desc) return op_desc; @@ -633,10 +637,6 @@ _eo2_class_funcs_set(_Eo_Class *klass) } else if (op_desc->op == EO2_OP_OVERRIDE) { - if (klass->parent == NULL) - ERR("Can't inherit from a NULL parent. Class '%s', Func index: %lu", - klass->desc->name, (unsigned long) (op_desc - op_descs)); - api_desc = _eo2_api_desc_get(op_desc->api_func, klass->parent, klass->extensions); if (api_desc == NULL) -- 2.7.4