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).



SVN revision: 68032
This commit is contained in:
Gustavo Sverzut Barbieri 2012-02-16 19:30:23 +00:00
parent 8bdf8faf37
commit 769d2e2210
1 changed files with 4 additions and 4 deletions

View File

@ -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;