Lines Matching refs:p

55 static void my_free(void *p) {	free(p); }  in my_free()  argument
57 #define free(p, t) my_free(p) argument
80 struct dn_heap_entry *p; in heap_resize() local
93 p = mallocarray(new_size, sizeof(*p), M_DN_HEAP, M_NOWAIT); in heap_resize()
94 if (p == NULL) { in heap_resize()
99 bcopy(h->p, p, h->size * sizeof(*p) ); in heap_resize()
100 free(h->p, M_DN_HEAP); in heap_resize()
102 h->p = p; in heap_resize()
129 *((int32_t *)((char *)(h->p[i].object) + h->ofs)) = i; \
137 *((int32_t *)((char *)(h->p[i].object) + h->ofs)) = -16; \
141 heap_insert(struct dn_heap *h, uint64_t key1, void *p) in heap_insert() argument
146 if (p == NULL) { /* data already there, set starting point */ in heap_insert()
154 h->p[son].object = p; in heap_insert()
155 h->p[son].key = key1; in heap_insert()
163 if (DN_KEY_LT( h->p[father].key, h->p[son].key ) ) in heap_insert()
166 HEAP_SWAP(h->p[son], h->p[father], tmp); in heap_insert()
197 if (obj != NULL && h->p[father].object != obj) in heap_extract()
209 DN_KEY_LT(h->p[child+1].key, h->p[child].key) ) in heap_extract()
211 h->p[father] = h->p[child]; in heap_extract()
221 h->p[father] = h->p[max]; in heap_extract()
237 struct dn_heap_entry *p, buf;
241 p = h->p; /* shortcut */
244 if (DN_KEY_LT(new_key, p[i].key) ) { /* must move up */
245 p[i].key = new_key;
247 DN_KEY_LT(new_key, p[(temp = HEAP_FATHER(i))].key);
249 HEAP_SWAP(p[i], p[temp], buf);
253 p[i].key = new_key;
257 DN_KEY_LT(p[temp+1].key, p[temp].key))
259 if (DN_KEY_LT(>p[temp].key, new_key)) {
261 HEAP_SWAP(p[i], p[temp], buf);
292 ret = fn(h->p[i].object, arg); in heap_scan()
295 h->p[i] = h->p[h->elements] ; in heap_scan()
314 free(h->p, M_DN_HEAP); in heap_free()
454 void **pp, *p; in dn_ht_find() local
461 for (pp = &ht->ht[i]; (p = *pp); pp = (void **)((char *)p + ht->ofs)) { in dn_ht_find()
463 if (key == (uintptr_t)p) in dn_ht_find()
465 } else if (ht->match(p, key, flags, arg)) /* found match */ in dn_ht_find()
468 if (p) { in dn_ht_find()
471 *pp = *(void **)((char *)p + ht->ofs); in dn_ht_find()
472 *(void **)((char *)p + ht->ofs) = NULL; in dn_ht_find()
478 p = ht->newh ? ht->newh(key, flags, arg) : (void *)key; in dn_ht_find()
480 if (p) { in dn_ht_find()
482 *(void **)((char *)p + ht->ofs) = ht->ht[i]; in dn_ht_find()
483 ht->ht[i] = p; in dn_ht_find()
486 return p; in dn_ht_find()