r6:Function:slist new

From liblfds.org
Jump to navigation Jump to search

Source Files



int slist_new( struct slist_state **ss,
               void (*user_data_delete_function)(void *user_data, void *user_state),
               void *user_state );


struct slist_state **ss

A pointer to a pointer onto which is allocated the state which represents an slist. Set to NULL if slist creation fails.

void (*user_data_delete_function)(void *user_data, void *user_state)

A callback function, which can be NULL. This function is called with the user data void pointer from each element after that element is logically deleted, giving the user an opportunity to delete any allocated state.

void *user_state

This is passed to each call of user_data_delete_function as the second argument to that function. The user is expected to use this to pass state information into his delete function.

Return Value

Returns 1 on successful list creation, 0 otherwise. On failure, *ss will also be set to NULL.


This function instantiates a slist. The values of user_data_delete_function and user_state are stored in the slist state for later use by slist_delete, slist_delete_element and slist_delete_all_elements.

See Also