Difference between pages "r6:Function:slist new head" and "r6:Function:slist new next"

From liblfds.org
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
m (1 revision imported)
 
Line 4: Line 4:


==Prototype==
==Prototype==
  struct slist_element *slist_new_head( struct slist_state *ss, void *user_data );
  struct slist_element *slist_new_next( struct slist_element *se, void *user_data );


==Parameters==
==Parameters==
''struct slist_state *ss''
''struct slist_element *se''
: An slist state as allocated by ''[[r6:Function:slist_new|slist_new]]''.
: An slist element as allocated by ''[[r6:Function:slist_new_head|slist_new_head]]'' or ''slist_new_next''.


''void *user_data''
''void *user_data''
: A void pointer of user data which will be placed into the list in the new head element.
: A void pointer of user data which will be placed into the list immediately after ''slist_element''.


==Return Value==
==Return Value==
Line 17: Line 17:


==Notes==
==Notes==
This function creates a new slist element holding ''user_data'' and links it into the slist as the head element.
This function creates a new slist element holding ''user_data'' and links it into the slist immediately after element ''se''.


==See Also==
==See Also==
* [[r6:API:SList|SList]]
* [[r6:API:SList|SList]]
* [[r6:Function:slist_new_next|slist_new_next]]
* [[r6:Function:slist_new_head|slist_new_head]]

Latest revision as of 14:07, 4 January 2015

Source Files

/src/slist/slist_new.c
/inc/liblfds.h

Prototype

struct slist_element *slist_new_next( struct slist_element *se, void *user_data );

Parameters

struct slist_element *se

An slist element as allocated by slist_new_head or slist_new_next.

void *user_data

A void pointer of user data which will be placed into the list immediately after slist_element.

Return Value

Returns a pointer to the new slist element. If element creation failed, which can only happen because of memory allocation failure, the return value is NULL.

Notes

This function creates a new slist element holding user_data and links it into the slist immediately after element se.

See Also