Lines Matching refs:head

103 #define HASH_FIND(hh,head,keyptr,keylen,out)                                     \  argument
106 if (head) { \
108 HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \
109 if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) { \
110 HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \
150 #define HASH_MAKE_TABLE(hh,head) \ argument
152 (head)->hh.tbl = (UT_hash_table*)uthash_malloc( \
154 if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \
155 memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \
156 (head)->hh.tbl->tail = &((head)->hh); \
157 (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \
158 (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \
159 (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \
160 (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \
162 if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \
163 memset((head)->hh.tbl->buckets, 0, \
165 HASH_BLOOM_MAKE((head)->hh.tbl); \
166 (head)->hh.tbl->signature = HASH_SIGNATURE; \
169 #define HASH_ADD(hh,head,fieldname,keylen_in,add) \ argument
170 HASH_ADD_KEYPTR(hh,head,&((add)->fieldname),keylen_in,add)
172 #define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \ argument
175 HASH_FIND(hh,head,&((add)->fieldname),keylen_in,replaced); \
177 HASH_DELETE(hh,head,replaced); \
179 HASH_ADD(hh,head,fieldname,keylen_in,add); \
182 #define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ argument
188 if (!(head)) { \
189 head = (add); \
190 (head)->hh.prev = NULL; \
191 HASH_MAKE_TABLE(hh,head); \
193 (head)->hh.tbl->tail->next = (add); \
194 (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \
195 (head)->hh.tbl->tail = &((add)->hh); \
197 (head)->hh.tbl->num_items++; \
198 (add)->hh.tbl = (head)->hh.tbl; \
199 HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \
201 HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \
202 HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \
203 HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \
204 HASH_FSCK(hh,head); \
224 #define HASH_DELETE(hh,head,delptr) \ argument
228 uthash_free((head)->hh.tbl->buckets, \
229 (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \
230 HASH_BLOOM_FREE((head)->hh.tbl); \
231 uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
232 head = NULL; \
236 if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \
237 (head)->hh.tbl->tail = \
239 (head)->hh.tbl->hho); \
243 (head)->hh.tbl->hho))->next = (delptr)->hh.next; \
245 DECLTYPE_ASSIGN(head,(delptr)->hh.next); \
249 (head)->hh.tbl->hho))->prev = \
252 HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \
253 HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \
254 (head)->hh.tbl->num_items--; \
256 HASH_FSCK(hh,head); \
261 #define HASH_FIND_STR(head,findstr,out) \ argument
262 HASH_FIND(hh,head,findstr,(unsigned)strlen(findstr),out)
263 #define HASH_ADD_STR(head,strfield,add) \ argument
264 HASH_ADD(hh,head,strfield[0],strlen(add->strfield),add)
265 #define HASH_REPLACE_STR(head,strfield,add,replaced) \ argument
266 HASH_REPLACE(hh,head,strfield[0],(unsigned)strlen(add->strfield),add,replaced)
267 #define HASH_FIND_INT(head,findint,out) \ argument
268 HASH_FIND(hh,head,findint,sizeof(int),out)
269 #define HASH_ADD_INT(head,intfield,add) \ argument
270 HASH_ADD(hh,head,intfield,sizeof(int),add)
271 #define HASH_REPLACE_INT(head,intfield,add,replaced) \ argument
272 HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced)
273 #define HASH_FIND_PTR(head,findptr,out) \ argument
274 HASH_FIND(hh,head,findptr,sizeof(void *),out)
275 #define HASH_ADD_PTR(head,ptrfield,add) \ argument
276 HASH_ADD(hh,head,ptrfield,sizeof(void *),add)
277 #define HASH_REPLACE_PTR(head,ptrfield,add,replaced) \ argument
278 HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced)
279 #define HASH_DEL(head,delptr) \ argument
280 HASH_DELETE(hh,head,delptr)
287 #define HASH_FSCK(hh,head) \ argument
290 if (head) { \
295 for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \
297 _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \
309 if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \
311 (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \
314 if (_count != (head)->hh.tbl->num_items) { \
316 (head)->hh.tbl->num_items, _count ); \
321 _thh = &(head)->hh; \
328 _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \
330 (head)->hh.tbl->hho) : NULL ); \
332 if (_count != (head)->hh.tbl->num_items) { \
334 (head)->hh.tbl->num_items, _count ); \
339 #define HASH_FSCK(hh,head) argument
346 #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ argument
353 #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) argument
611 #define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out) \ argument
613 if (head.hh_head) DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,head.hh_head)); \
625 #define HASH_ADD_TO_BKT(head,addhh) \ argument
627 head.count++; \
628 (addhh)->hh_next = head.hh_head; \
630 if (head.hh_head) { (head).hh_head->hh_prev = (addhh); } \
631 (head).hh_head=addhh; \
632 if (head.count >= ((head.expand_mult+1) * HASH_BKT_CAPACITY_THRESH) \
639 #define HASH_DEL_IN_BKT(hh,head,hh_del) \ argument
640 (head).count--; \
641 if ((head).hh_head == hh_del) { \
642 (head).hh_head = hh_del->hh_next; \
732 #define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) argument
733 #define HASH_SRT(hh,head,cmpfcn) \ argument
738 if (head) { \
741 _hs_list = &((head)->hh); \
755 (head)->hh.tbl->hho)) : NULL); \
764 (head)->hh.tbl->hho)) : NULL); \
771 (head)->hh.tbl->hho)) : NULL); \
775 cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \
776 DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \
782 (head)->hh.tbl->hho)) : NULL); \
789 (head)->hh.tbl->hho)) : NULL); \
794 ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \
800 ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \
811 (head)->hh.tbl->tail = _hs_tail; \
812 DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \
816 HASH_FSCK(hh,head); \
863 #define HASH_CLEAR(hh,head) \ argument
865 if (head) { \
866 uthash_free((head)->hh.tbl->buckets, \
867 (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \
868 HASH_BLOOM_FREE((head)->hh.tbl); \
869 uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
870 (head)=NULL; \
874 #define HASH_OVERHEAD(hh,head) \ argument
875 ((head) ? ( \
876 (size_t)((((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \
877 ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \
882 #define HASH_ITER(hh,head,el,tmp) \ argument
883 for((el)=(head), (*(char**)(&(tmp)))=(char*)((head)?(head)->hh.next:NULL); \
886 #define HASH_ITER(hh,head,el,tmp) \ argument
887 for((el)=(head),(tmp)=DECLTYPE(el)((head)?(head)->hh.next:NULL); \
892 #define HASH_COUNT(head) HASH_CNT(hh,head) argument
893 #define HASH_CNT(hh,head) ((head)?((head)->hh.tbl->num_items):0) argument