]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.0.0 / liblfds700 / src / lfds700_hash_addonly / lfds700_hash_addonly_get.c
1 /***** includes *****/
2 #include "lfds700_hash_addonly_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has,
10                                void *key,
11                                struct lfds700_hash_a_element **hae )
12 {
13   int
14     rv;
15
16   lfds700_pal_uint_t
17     hash = 0;
18
19   struct lfds700_btree_au_element
20     *baue;
21
22   LFDS700_PAL_ASSERT( has != NULL );
23   // TRD : key can be NULL
24   LFDS700_PAL_ASSERT( hae != NULL );
25
26   has->key_hash_function( key, &hash );
27
28   rv = lfds700_btree_au_get_by_key( has->baus_array + (hash % has->array_size), key, &baue );
29
30   if( rv == 1 )
31     *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue );
32   else
33     *hae = NULL;
34
35   return( rv );
36 }
37