• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/router/dhcp6/

Lines Matching defs:hash_tbl

55 	struct hash_table *hash_tbl;
56 hash_tbl = malloc(sizeof(struct hash_table));
57 if (!hash_tbl) {
61 hash_tbl->hash_list = malloc(sizeof(struct hashlist_element *)*hash_size);
63 hash_tbl->hash_list[i] = NULL;
65 hash_tbl->hash_count = 0;
66 hash_tbl->hash_size = hash_size;
67 hash_tbl->hash_function = hash_function;
68 hash_tbl->find_hashkey = find_hashkey;
69 hash_tbl->compare_hashkey = compare_hashkey;
70 return hash_tbl;
73 int hash_add(struct hash_table *hash_tbl, const void *key, void *data)
82 if (hash_full(hash_tbl)) {
83 grow_hash(hash_tbl);
85 index = hash_tbl->hash_function(key) % hash_tbl->hash_size;
86 if (hash_search(hash_tbl, key)) {
90 element->next = hash_tbl->hash_list[index];
91 hash_tbl->hash_list[index] = element;
93 hash_tbl->hash_count++;
97 int hash_delete(struct hash_table *hash_tbl, const void *key)
101 index = hash_tbl->hash_function(key) % hash_tbl->hash_size;
102 element = hash_tbl->hash_list[index];
104 if (MATCH == hash_tbl->compare_hashkey(element->data, key)) {
108 hash_tbl->hash_list[index] = element->next;
112 hash_tbl->hash_count--;
121 void * hash_search(struct hash_table *hash_tbl, const void *key)
125 index = hash_tbl->hash_function(key) % hash_tbl->hash_size;
126 element = hash_tbl->hash_list[index];
128 if (MATCH == hash_tbl->compare_hashkey(element->data, key)) {
136 int hash_full(struct hash_table *hash_tbl) {
138 if((hash_tbl->hash_count)*100/(hash_tbl->hash_size) > 90) rc = 1;
142 int grow_hash(struct hash_table *hash_tbl) {
147 hash_size = 2*hash_tbl->hash_size;
148 new_table = hash_table_create(hash_size, hash_tbl->hash_function,
149 hash_tbl->find_hashkey, hash_tbl->compare_hashkey);
154 for (i = 0; i < hash_tbl->hash_size; i++) {
155 element = hash_tbl->hash_list[i];
157 key = hash_tbl->find_hashkey(element->data);
166 free(hash_tbl->hash_list);
167 hash_tbl->hash_count = new_table->hash_count;
168 hash_tbl->hash_size = hash_size;
169 hash_tbl->hash_list = new_table->hash_list;