function lfds710_list_asu_get_by_key

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds710
    ├───inc
    │   └───liblfds710
    │           lfds710_list_addonly_singlylinked_unordered.h
    └───src
        └───llfds710_list_addonly_singlylinked_unordered
                lfds710_list_addonly_singlylinked_unordered_get.c

Opaque Structures

struct lfds710_list_asu_element;
struct lfds710_list_asu_state;

Prototype

int lfds710_list_asu_get_by_key( struct lfds710_list_asu_state *lasus,
                                 int (*key_compare_function)(void const *new_key, void const *existing_key),
                                 void *key, 
                                 struct lfds710_list_asu_element **lasue );

Parameters

struct lfds710_list_asu_state *lasus

A pointer to an initialized struct lfds710_list_asu_state.

int (*key_compare_function)(void const *new_key, void const *existing_key)

A callback used by the list to compare keys. The callback returns 0 if the keys are equal, smaller than zero if new_key is smaller than existing_key and greater than zero if new_key is greater than existing_key (i.e. as strcmp).

void *key

A pointer to the key to find in the list.

struct lfds710_list_asu_element **lasue

Set to point to the element containing key, or NULL if this key does not exist in the list.

Return Value

Returns 1 if an element with key is found, otherwise returns 0.

Notes

Iterates over the list, searching for the element with key key. Remember that the list is unordered; this is a convenience function only.

See Also