Hello,

Both eina_inlist_prepend_relative and eina_list_prepend_relative_list
takes three arguments: list, data and relative. If relative is NULL,
both execute the non-relative version: eina_inlist_prepend and
eina_list_prepend.

This means that there's no way to make eina_inlist_prepend_relative
and eina_list_prepend_relative_list to append on the end of the list.
I think that NULL should be considered as a past-the-end element and
the result would be prepending relative to the past-the-end element,
i.e., appending.

If we consider this list:

[a -> b -> c -> d -> NULL]

We can see that prepending relative to /a/ means eina_list_prepend,
relative to /b/ means inserting the element between /a/ and /b/. And
if we consider the following empty list:

[NULL]

eina_list_prepend and eina_list_prepend_relative prepends before the
past-the-end node. So:

Eina_List* list = NULL;

List list: [NULL]

int i = 5;
void* data = &i;

list = eina_list_prepend_relative(list, data, NULL);

[i -> NULL]

The current behavior of doing normal prepend when relative is NULL
forces some algorithms to do

if(pos)
  list = eina_list_prepend_relative_list(list, data, pos);
else
  list = eina_list_append(list, data);

Which seems unnecessary. Am I missing something?

Regards,
-- 
Felipe Magno de Almeida

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to