function lfds711_list_asu_get_by_key

From liblfds.org
Revision as of 18:11, 16 February 2017 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

└───liblfds711
    ├───inc
    │   └───liblfds711
    │           lfds711_list_addonly_singlylinked_unordered.h
    └───src
        └───llfds711_list_addonly_singlylinked_unordered
                lfds711_list_addonly_singlylinked_unordered_get.c

Opaque Structures

struct lfds711_list_asu_element;
struct lfds711_list_asu_state;

Prototype

int lfds711_list_asu_get_by_key( struct lfds711_list_asu_state *lasus,
                                 int (*key_compare_function)(void const *new_key, void const *existing_key),
                                 void *key, 
                                 struct lfds711_list_asu_element **lasue );

Parameters

struct lfds711_list_asu_state *lasus

A pointer to an initialized struct lfds711_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 lfds711_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