Forwards version of pool_copy_array_rev.
Signed-off-by: Kaz Wesley <kaz@lambdaverse.org>
return &pool[p];
}
+pool_ptr
+pool_copy_array (const pool_object * objs, uint32_t len)
+{
+ if (!len)
+ return 0;
+ pool_ptr p = pool_alloc (len);
+ for (int i = 0; i < len; i++)
+ {
+ pool[p + i] = (pool_object)
+ {
+ .type = objs[i].type,.rest = p + i + 1,.val = objs[i].val};
+ }
+ pool[p + len - 1].rest = 0;
+ return p;
+}
+
pool_ptr
pool_copy_array_rev (const pool_object * objs, uint32_t len)
{
}
// given a headerless array of objects of known size,
-// copy it backwards into newly-allocated pool space
+// copy it into newly-allocated pool space
+pool_ptr pool_copy_array (const pool_object * objs, uint32_t len);
+// same as above, but backwards
pool_ptr pool_copy_array_rev (const pool_object * objs, uint32_t len);
heap_ptr heap_copy_array_rev (const object * objs, uint32_t len);