1 #include "tommyDS_hashlin/tommychain.h"
2 #include "tommyDS_hashlin/tommyhash.h"
3 #include "tommyDS_hashlin/tommyhashlin.h"
4 #include "tommyDS_hashlin/tommylist.h"
5 #include "tommyDS_hashlin/tommytypes.h"
6 #include "tommyDS_hashlin/tommyhash.c"
7 #include "tommyDS_hashlin/tommyhashlin.c"
8 #include "tommyDS_hashlin/tommylist.c"
10 void init_hash_table(void *ht
, void *ll
)
12 tommy_hashlin_init(ht
);
16 void add_hash_table(void *ht
, void *ht_node
, void *ll
, void *ll_node
, void *obj
, void *key
, int key_len
)
18 tommy_hashlin_insert(ht
, ht_node
, obj
, tommy_hash_u32(0, key
, key_len
));
19 tommy_list_insert_tail(ll
, ll_node
, obj
);
22 void *find_hash_table(void *ht
, void *key
, int key_len
, void *compare
)
24 return tommy_hashlin_search(ht
, compare
, key
, tommy_hash_u32(0, key
, key_len
));
27 void *search_remove_elem_hash_table(void *ht
, void *key
, int key_len
, void *compare
)
29 return tommy_hashlin_remove(ht
, compare
, key
, tommy_hash_u32(0, key
, key_len
));
32 void *remove_elem_hash_table(void *ht
, void *ht_node
)
34 return tommy_hashlin_remove_existing(ht
, ht_node
);
37 int count_hash_table(void *ht
)
39 return tommy_hashlin_count(ht
);
42 void deinitialize_hash_table(void *ht
)
44 tommy_hashlin_done(ht
);
47 void sort_list(void *ll
, void *cmp
)
49 tommy_list_sort (ll
, cmp
);
52 void *remove_elem_list(void *ll
, void *ll_node
)
54 return tommy_list_remove_existing(ll
, ll_node
);
57 void *get_first_node_list(void *ll
)
59 return tommy_list_head(ll
);
62 void *get_first_elem_list(void *ll
)
64 if (tommy_list_head(ll
))
65 return tommy_list_head(ll
)->data
;
70 void *get_data_from_node(void *node
)
73 return ((tommy_node
*)node
)->data
;