libk  Artifact [930b5d7379]

Artifact 930b5d7379f92ad16e9e3e72d41a4e3bd601e6a2639bfd14576dd492f84fdf67:


#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;
}