Linked List Ordering Functions
Functions that change the ordering of data in a linked list. More...Functions | |
EAPI Evas_List * | evas_list_reverse (Evas_List *list) |
Reverse all the elements in the list. | |
EAPI Evas_List * | evas_list_sort (Evas_List *list, int size, int(*func)(void *, void *)) |
Sort a list according to the ordering func will return. |
Detailed Description
Functions that change the ordering of data in a linked list.
Function Documentation
Reverse all the elements in the list.
- Parameters:
-
list The list to reverse
- Returns:
- The list after it has been reversed
list
, and reverses the order of all elements in the list, so the last member is now first, and so on.Example:
extern Evas_List *list; list = evas_list_reverse(list);
References _Evas_List::accounting, _Evas_List::data, _Evas_List::next, and _Evas_List::prev.
Sort a list according to the ordering func will return.
- Parameters:
-
list The list handle to sort size The length of the list to sort func A function pointer that can handle comparing the list data nodes
- Returns:
- A new sorted list
Example:
int sort_cb(void *d1, void *d2) { const char *txt = NULL; const char *txt2 = NULL; if(!d1) return(1); if(!d2) return(-1); return(strcmp((const char*)d1, (const char*)d2)); } extern Evas_List *list; list = evas_list_sort(list, evas_list_count(list), sort_cb); if (evas_list_alloc_error()) { fprintf(stderr, "ERROR: Memory is low. List Sorting failed.\n"); exit(-1); }
References _Evas_List::accounting, _Evas_List::data, evas_list_next(), evas_list_prev(), _Evas_List::next, and _Evas_List::prev.