From b33974733ff565f69b64d2675ec42d678c17ca51 Mon Sep 17 00:00:00 2001 From: barbieri Date: Thu, 16 Feb 2012 19:30:23 +0000 Subject: [PATCH] 1/3 eina_model: lookup interfaces in the correct order. We should lookup then in forward order, as they are sorted from most-specific first, with parents at the end. This breaks test, will fix in the last commit (3/3). git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@68032 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/eina_model.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/eina_model.c b/src/lib/eina_model.c index b6d3589..104f4dd 100644 --- a/src/lib/eina_model.c +++ b/src/lib/eina_model.c @@ -3487,17 +3487,17 @@ EAPI const Eina_Model_Interface * eina_model_interface_get(const Eina_Model *model, const char *name) { const Eina_Model_Description *desc; - const Eina_Model_Interface **itr, **itr_first; + const Eina_Model_Interface **itr, **itr_end; EINA_MODEL_INSTANCE_CHECK_VAL(model, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL); desc = model->desc; - itr_first = desc->cache.ifaces; - itr = itr_first + desc->total.ifaces - 1; + itr = desc->cache.ifaces; + itr_end = itr + desc->total.ifaces; /* fallback to strcmp if user is lazy about speed */ - for (; itr >= itr_first; itr--) + for (; itr < itr_end; itr++) if (strcmp((*itr)->name, name) == 0) return *itr; -- 2.7.4