]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/liblfds710/src/lfds710_list_addonly_singlylinked_ordered/lfds710_list_addonly_singlylinked_ordered_get.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / liblfds710 / src / lfds710_list_addonly_singlylinked_ordered / lfds710_list_addonly_singlylinked_ordered_get.c
1 /***** includes *****/
2 #include "lfds710_list_addonly_singlylinked_ordered_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 int lfds710_list_aso_get_by_key( struct lfds710_list_aso_state *lasos,
10                                  void *key,
11                                  struct lfds710_list_aso_element **lasoe )
12 {
13   int
14     cr = !0,
15     rv = 1;
16
17   LFDS710_PAL_ASSERT( lasos != NULL );
18   // TRD : key can be NULL
19   LFDS710_PAL_ASSERT( lasoe != NULL );
20
21   while( cr != 0 and LFDS710_LIST_ASO_GET_START_AND_THEN_NEXT(*lasos, *lasoe) )
22     cr = lasos->key_compare_function( key, (*lasoe)->key );
23
24   if( *lasoe == NULL )
25     rv = 0;
26
27   return rv;
28 }
29