Linked List General Functions
Miscellaneous functions that work on linked lists. More...Functions | |
EAPI void * | evas_list_data (Evas_List *list) |
Get the list node data member. | |
EAPI int | evas_list_count (Evas_List *list) |
Get the count of the number of items in a list. | |
EAPI int | evas_list_alloc_error (void) |
Return the memory allocation failure flag after any operation needin allocation. |
Detailed Description
Miscellaneous functions that work on linked lists.
Function Documentation
EAPI int evas_list_alloc_error | ( | void | ) |
Return the memory allocation failure flag after any operation needin allocation.
- Returns:
- The state of the allocation flag
Example:
Evas_List *list = NULL; extern void *my_data; list = evas_list_append(list, my_data); if (evas_list_alloc_error()) { fprintf(stderr, "ERROR: Memory is low. List allocation failed.\n"); exit(-1); }
Referenced by evas_hash_add(), and evas_hash_direct_add().
EAPI int evas_list_count | ( | Evas_List * | list | ) |
Get the count of the number of items in a list.
- Parameters:
-
list The list whose count to return
- Returns:
- The number of members in the list
list
list
. If the list is empty (NULL), 0 is returned.NB: This is an order-1 operation and takes the same tiem regardless of the length of the list.
Example:
extern Evas_List *list; printf("The list has %i members\n", evas_list_count(list));
References _Evas_List::accounting.
EAPI void* evas_list_data | ( | Evas_List * | list | ) |
Get the list node data member.
- Parameters:
-
list The list node to get the data member of
- Returns:
- The data member from the list node
list
list
. It is equivalent to list->data.Example:
extern Evas_List *list; Evas_List *l; printf("The list:\n"); for (l = list; l; l = evas_list_next(l)) { printf("%p\n", evas_list_data(l)); }
References _Evas_List::data.