Lines Matching defs:self

279 static void bin_chunk(struct chunk *self, int i)
281 self->next = BIN_TO_CHUNK(i);
282 self->prev = mal.bins[i].tail;
283 self->next->prev = self;
284 self->prev->next = self;
285 if (self->prev == BIN_TO_CHUNK(i))
289 static void trim(struct chunk *self, size_t n)
291 size_t n1 = CHUNK_SIZE(self);
296 next = NEXT_CHUNK(self);
297 split = (void *)((char *)self + n);
307 self->csize = n | C_INUSE;
309 calculate_checksum(self, NULL);
408 struct chunk *self, *next;
416 self = MEM_TO_CHUNK(p);
417 n1 = n0 = CHUNK_SIZE(self);
421 if (IS_MMAPPED(self)) {
422 size_t extra = self->psize;
423 char *base = (char *)self - extra;
430 get_free_trace(CHUNK_TO_MEM(self));
453 self = (void *)(base + extra);
454 self->csize = newlen - extra;
455 return CHUNK_TO_MEM(self);
458 next = NEXT_CHUNK(self);
461 if (next->psize != self->csize) a_crash();
468 struct chunk *split = (void *)((char *)self + n);
472 self->csize = split->psize = n | C_INUSE;
475 calculate_checksum(self, next);
479 return CHUNK_TO_MEM(self);
492 self->csize = next->psize = n0+nsize | C_INUSE;
493 trim(self, n);
498 get_free_trace(CHUNK_TO_MEM(self));
501 insert_node(CHUNK_TO_MEM(self), CHUNK_SIZE(self));
505 return CHUNK_TO_MEM(self);
517 free(CHUNK_TO_MEM(self));
521 void __bin_chunk(struct chunk *self)
523 struct chunk *next = NEXT_CHUNK(self);
526 if (next->psize != self->csize) a_crash();
530 size_t osize = CHUNK_SIZE(self), size = osize;
537 size_t psize = self->psize & C_INUSE ? 0 : CHUNK_PSIZE(self);
540 calculate_checksum(self, next);
547 if (!(self->psize & C_INUSE)) {
548 struct chunk *prev = PREV_CHUNK(self);
550 self = prev;
571 self->csize = size;
574 calculate_checksum(self, next);
577 bin_chunk(self, i);
582 uintptr_t a = (uintptr_t)self + SIZE_ALIGN+PAGE_SIZE-1 & -PAGE_SIZE;
597 static void unmap_chunk(struct chunk *self)
599 size_t extra = self->psize;
600 char *base = (char *)self - extra;
601 size_t len = CHUNK_SIZE(self) + extra;
606 get_free_trace(CHUNK_TO_MEM(self));
628 struct chunk *self = MEM_TO_CHUNK(p);
631 if (!IS_MMAPPED(self)) {
632 check_chunk_integrity(self);
642 if (IS_MMAPPED(self))
643 unmap_chunk(self);
647 insert_free_tail(self);
655 self = get_free_head();
658 __bin_chunk(self);