ANN void free_vm(VM* vm);
ANN void vm_add_shred(const VM* vm, const VM_Shred shred)__attribute__((hot));
ANN void vm_remove(const VM* vm, const m_uint index)__attribute__((hot));
-ANN m_str code_name_set(const m_str, const m_str);
+ANN m_str code_name_set(MemPool p, const m_str, const m_str);
ANN m_str code_name(const m_str, const m_bool);
ANN uint32_t gw_rand(uint32_t s[2]);
ANN void gw_seed(uint32_t s[2], const uint64_t);
ANEW static Code* new_code(const Emitter emit, const m_str name) {
Code* code = mp_calloc(emit->gwion->mp, Code);
- code->name = code_name_set(name, emit->env->name);
+ code->name = code_name_set(emit->gwion->mp, name, emit->env->name);
vector_init(&code->instr);
vector_init(&code->stack_break);
vector_init(&code->stack_cont);
vector_release(&code->stack_cont);
vector_release(&code->stack_return);
free_frame(p, code->frame);
- xfree(code->name);
+ free_mstr(p, code->name);
mp_free(p, Code, code);
}
#include "gwion_util.h"
#include "gwion_ast.h"
-m_str code_name_set(const m_str name, const m_str file) {
+m_str code_name_set(MemPool p, const m_str name, const m_str file) {
const size_t len = strlen(name) + strlen(file) + 2;
- m_str str = (const m_str)xcalloc(1, len);
+ m_str str = (const m_str)_mp_malloc(p, len);
sprintf(str, "%s$%s", name, file);
return str;
}