Lines Matching refs:len
68 heap_size len; // size in units of "sizeof(heap_node)" member
88 freelist->len = HEAP_SIZE / sizeof(heap_node); in init_heap()
92 size_t alloc_size(size_t len) { in alloc_size() argument
93 return (len + sizeof(heap_node) - 1) / sizeof(heap_node) + 1; in alloc_size()
100 void* fallback_malloc(size_t len) { in fallback_malloc() argument
102 const size_t nelems = alloc_size(len); in fallback_malloc()
112 if (p->len > nelems) { // chunk is larger, shorten, and return the tail in fallback_malloc()
115 p->len = static_cast<heap_size>(p->len - nelems); in fallback_malloc()
116 q = p + p->len; in fallback_malloc()
118 q->len = static_cast<heap_size>(nelems); in fallback_malloc()
122 if (p->len == nelems) { // exact size match in fallback_malloc()
135 heap_node* after(struct heap_node* p) { return p + p->len; } in after()
144 std::printf("Freeing item at %d of size %d\n", offset_from_node(cp), cp->len); in fallback_free()
158 p->len = static_cast<heap_size>( in fallback_free()
159 p->len + cp->len); // make the free heap_node larger in fallback_free()
165 cp->len = static_cast<heap_size>(cp->len + p->len); in fallback_free()
192 (prev == 0 ? "" : " "), offset_from_node(p), p->len, p->next_node); in print_free_list()
193 total_free += p->len; in print_free_list()