libk  heapao.fn.c at [b590aba21d]

File kmem/heapao.fn.c artifact 930b5d7379 part of check-in b590aba21d


#include <k/core.h>
#include <k/mem.h>
/* heapao.fn.c - kmheapao() "allocate heap object"
 * ~ lexi hale <lexi@hale.su>
 * kmheapao() allocates a region in heap memory
 * and returns a kmptr struct referencing that
 * newly allocated region.
 */

kmptr kmheapao(sz size) {
	void* ptr = kmheapa(size);
	kmptr p = {
		.kind = (ptr != null ? kmkind_heap : kmkind_fail),
		.ref = ptr,
		.shred = false,
	}; return p;
}