r6.0.1:lfds601_slist_new

From liblfds.org
Jump to navigation Jump to search

Source Files

/liblfds601/src/lfds601_slist/lfds601_slist_new.c
/liblfds601/inc/liblfds601.h

Prototype

int lfds601_slist_new( struct lfds601_slist_state **ss,
                     void (*user_data_delete_function)(void *user_data, void *user_state),
                     void *user_state );

Parameters

struct lfds601_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.

Notes

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 lfds601_slist_delete, lfds601_slist_delete_element and lfds601_slist_delete_all_elements.

See Also