Linked List Creation Functions

Functions that add data to an Evas_List. More...

Functions

Evas_Listevas_list_append (Evas_List *list, const void *data)
 Appends the given data to the given linked list.
Evas_Listevas_list_prepend (Evas_List *list, const void *data)
 Prepends the given data to the given linked list.
Evas_Listevas_list_append_relative (Evas_List *list, const void *data, const void *relative)
 Inserts the given data into the given linked list after the specified data.
Evas_Listevas_list_prepend_relative (Evas_List *list, const void *data, const void *relative)
 Prepend a data pointer to a linked list before the memeber specified.

Detailed Description

Functions that add data to an Evas_List.


Function Documentation

Evas_List* evas_list_append Evas_List list,
const void *  data
 

Appends the given data to the given linked list.

The following example code demonstrates how to ensure that the given data has been successfully appended.

 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);
   }

Parameters:
list The given list. If NULL is given, then a new list is created.
data The data to append.
Returns:
A new list pointer that should be used in place of the one given to this function if successful. Otherwise, the old pointer is returned.

Evas_List* evas_list_append_relative Evas_List list,
const void *  data,
const void *  relative
 

Inserts the given data into the given linked list after the specified data.

If relative is not in the list, data is appended to the end of the list. If there are multiple instances of relative in the list, data is inserted after the first instance.

The following example code demonstrates how to ensure that the given data has been successfully inserted.

 Evas_List *list = NULL;
 extern void *my_data;
 extern void *relative_member;

 list = evas_list_append(list, relative_member);
 if (evas_list_alloc_error())
   {
     fprintf(stderr, "ERROR: Memory is low. List allocation failed.\n");
     exit(-1);
   }
 list = evas_list_append_relative(list, my_data, relative_member);
 if (evas_list_alloc_error())
   {
     fprintf(stderr, "ERROR: Memory is low. List allocation failed.\n");
     exit(-1);
   }

Parameters:
list The given linked list.
data The given data.
relative The data to insert after.
Returns:
A new list pointer that should be used in place of the one given to this function if successful. Otherwise, the old pointer is returned.

Evas_List* evas_list_prepend Evas_List list,
const void *  data
 

Prepends the given data to the given linked list.

The following example code demonstrates how to ensure that the given data has been successfully prepended.

Example:

 Evas_List *list = NULL;
 extern void *my_data;

 list = evas_list_prepend(list, my_data);
 if (evas_list_alloc_error())
   {
     fprintf(stderr, "ERROR: Memory is low. List allocation failed.\n");
     exit(-1);
   }

Parameters:
list The given list.
data The given data.
Returns:
A new list pointer that should be used in place of the one given to this function, if successful. Otherwise, the old pointer is returned.

Evas_List* evas_list_prepend_relative Evas_List list,
const void *  data,
const void *  relative
 

Prepend a data pointer to a linked list before the memeber specified.

Parameters:
list The list handle to prepend data too
data The data pointer to prepend to list list before relative
relative The data pointer before which to insert data
Returns:
A new list handle to replace the old one
Inserts the given data into the given linked list before the member specified.

If relative is not in the list, data is prepended to the start of the list. If there are multiple instances of relative in the list, data is inserted before the first instance.

The following code example demonstrates how to ensure that the given data has been successfully inserted.

 Evas_List *list = NULL;
 extern void *my_data;
 extern void *relative_member;

 list = evas_list_append(list, relative_member);
 if (evas_list_alloc_error())
   {
     fprintf(stderr, "ERROR: Memory is low. List allocation failed.\n");
     exit(-1);
   }
 list = evas_list_prepend_relative(list, my_data, relative_member);
 if (evas_list_alloc_error())
   {
     fprintf(stderr, "ERROR: Memory is low. List allocation failed.\n");
     exit(-1);
   }

Parameters:
list The given linked list.
data The given data.
relative The data to insert before.
Returns:
A new list pointer that should be used in place of the one given to this function if successful. Otherwise the old pointer is returned.