r6.1.1:lfds611_freelist_pop

From liblfds.org
Revision as of 14:07, 4 January 2015 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

/liblfds611/src/lfds611_freelist/lfds611_freelist_pop_push.c
/liblfds611/inc/liblfds611.h

Prototype

struct lfds611_freelist_element *lfds611_freelist_pop( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe );

Parameters

struct lfds611_freelist_state *fs

A freelist state as allocated by lfds611_freelist_new.

struct lfds611_freelist_element **fe

A pointer to a freelist element pointer which will be set to point to a struct freelist popped from the freelist. Set to NULL if the freelist is empty.

Return Value

Returns a pointer to the freelist element (e.g. the value *fe is set to). If the freelist is empty, the return value is NULL and *lfds611_freelist_element is set to NULL. In this case, the user can call, the caller can call lfds611_freelist_guaranteed_pop, which will allocate a new element, rather than popping from the freelist. Remember however that the freelist can never shrink, so any such call will permanently increase the size of the freelist by one element.

Notes

Popping returns to the user a freelist element. To obtain the user data void pointer from the element, use lfds611_freelist_get_user_data_from_element.

See Also