• Home
  • Raw
  • Download

Lines Matching refs:head

92 #define HASH_FIND(hh,head,keyptr,keylen,out)                                     \  argument
96 if (head) { \
97 HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \
98 if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) { \
99 HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \
138 #define HASH_MAKE_TABLE(hh,head) \ argument
140 (head)->hh.tbl = (UT_hash_table*)uthash_malloc( \
142 if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \
143 memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \
144 (head)->hh.tbl->tail = &((head)->hh); \
145 (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \
146 (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \
147 (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \
148 (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \
150 if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \
151 memset((head)->hh.tbl->buckets, 0, \
153 HASH_BLOOM_MAKE((head)->hh.tbl); \
154 (head)->hh.tbl->signature = HASH_SIGNATURE; \
157 #define HASH_ADD(hh,head,fieldname,keylen_in,add) \ argument
158 HASH_ADD_KEYPTR(hh,head,&add->fieldname,keylen_in,add)
160 #define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ argument
166 if (!(head)) { \
167 head = (add); \
168 (head)->hh.prev = NULL; \
169 HASH_MAKE_TABLE(hh,head); \
171 (head)->hh.tbl->tail->next = (add); \
172 (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \
173 (head)->hh.tbl->tail = &((add)->hh); \
175 (head)->hh.tbl->num_items++; \
176 (add)->hh.tbl = (head)->hh.tbl; \
177 HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \
179 HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \
180 HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \
181 HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \
182 HASH_FSCK(hh,head); \
202 #define HASH_DELETE(hh,head,delptr) \ argument
207 uthash_free((head)->hh.tbl->buckets, \
208 (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \
209 HASH_BLOOM_FREE((head)->hh.tbl); \
210 uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
211 head = NULL; \
214 if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \
215 (head)->hh.tbl->tail = \
217 (head)->hh.tbl->hho); \
221 (head)->hh.tbl->hho))->next = (delptr)->hh.next; \
223 DECLTYPE_ASSIGN(head,(delptr)->hh.next); \
227 (head)->hh.tbl->hho))->prev = \
230 HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \
231 HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \
232 (head)->hh.tbl->num_items--; \
234 HASH_FSCK(hh,head); \
247 #define HASH_FIND_STR(head,findstr,out) \ argument
248 HASH_FIND(hh,head,findstr,strlen(findstr),out)
249 #define HASH_ADD_STR(head,strfield,add) \ argument
250 HASH_ADD(hh,head,strfield,strlen(add->strfield),add)
251 #define HASH_FIND_INT(head,findint,out) \ argument
252 HASH_FIND(hh,head,findint,sizeof(int),out)
253 #define HASH_ADD_INT(head,intfield,add) \ argument
254 HASH_ADD(hh,head,intfield,sizeof(int),add)
255 #define HASH_FIND_PTR(head,findptr,out) \ argument
256 HASH_FIND(hh,head,findptr,sizeof(void *),out)
257 #define HASH_ADD_PTR(head,ptrfield,add) \ argument
258 HASH_ADD(hh,head,ptrfield,sizeof(void *),add)
259 #define HASH_DEL(head,delptr) \ argument
260 HASH_DELETE(hh,head,delptr)
267 #define HASH_FSCK(hh,head) \ argument
273 if (head) { \
275 for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \
277 _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \
289 if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \
291 (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \
294 if (_count != (head)->hh.tbl->num_items) { \
296 (head)->hh.tbl->num_items, _count ); \
301 _thh = &(head)->hh; \
308 _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \
310 (head)->hh.tbl->hho) : NULL ); \
312 if (_count != (head)->hh.tbl->num_items) { \
314 (head)->hh.tbl->num_items, _count ); \
319 #define HASH_FSCK(hh,head) argument
326 #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ argument
333 #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) argument
584 #define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out) \ argument
586 if (head.hh_head) DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,head.hh_head)); \
598 #define HASH_ADD_TO_BKT(head,addhh) \ argument
600 head.count++; \
601 (addhh)->hh_next = head.hh_head; \
603 if (head.hh_head) { (head).hh_head->hh_prev = (addhh); } \
604 (head).hh_head=addhh; \
605 if (head.count >= ((head.expand_mult+1) * HASH_BKT_CAPACITY_THRESH) \
612 #define HASH_DEL_IN_BKT(hh,head,hh_del) \ argument
613 (head).count--; \
614 if ((head).hh_head == hh_del) { \
615 (head).hh_head = hh_del->hh_next; \
705 #define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) argument
706 #define HASH_SRT(hh,head,cmpfcn) \ argument
711 if (head) { \
714 _hs_list = &((head)->hh); \
728 (head)->hh.tbl->hho)) : NULL); \
737 (head)->hh.tbl->hho)) : NULL); \
743 (head)->hh.tbl->hho)) : NULL); \
746 cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \
747 DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \
752 (head)->hh.tbl->hho)) : NULL); \
758 (head)->hh.tbl->hho)) : NULL); \
763 ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \
768 ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \
776 (head)->hh.tbl->tail = _hs_tail; \
777 DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \
781 HASH_FSCK(hh,head); \
828 #define HASH_CLEAR(hh,head) \ argument
830 if (head) { \
831 uthash_free((head)->hh.tbl->buckets, \
832 (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \
833 uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
834 (head)=NULL; \
839 #define HASH_ITER(hh,head,el,tmp) \ argument
840 for((el)=(head), (*(char**)(&(tmp)))=(char*)((head)?(head)->hh.next:NULL); \
843 #define HASH_ITER(hh,head,el,tmp) \ argument
844 for((el)=(head),(tmp)=DECLTYPE(el)((head)?(head)->hh.next:NULL); \
849 #define HASH_COUNT(head) HASH_CNT(hh,head) argument
850 #define HASH_CNT(hh,head) ((head)?((head)->hh.tbl->num_items):0) argument