Always use jv_mem_*alloc()
This commit is contained in:
1 parent
4b4cf789e0
commit
0bd7614bd5
7 files changed
+13
-11
No files matched your search
+3
-3
@@ -1296,7 +1296,7 @@ static int compile(struct bytecode* bc, block b, struct locfile* lf, jv args, jv
|
||||
bc->codelen = pos;
|
||||
bc->debuginfo = jv_object_set(bc->debuginfo, jv_string("locals"), localnames);
|
||||
if (bc->nsubfunctions) {
|
||||
bc->subfunctions = jv_mem_alloc(sizeof(struct bytecode*) * bc->nsubfunctions);
|
||||
bc->subfunctions = jv_mem_calloc(sizeof(struct bytecode*), bc->nsubfunctions);
|
||||
for (inst* curr = b.first; curr; curr = curr->next) {
|
||||
if (curr->op == CLOSURE_CREATE) {
|
||||
struct bytecode* subfn = jv_mem_alloc(sizeof(struct bytecode));
|
||||
@@ -1321,7 +1321,7 @@ static int compile(struct bytecode* bc, block b, struct locfile* lf, jv args, jv
|
||||
} else {
|
||||
bc->subfunctions = 0;
|
||||
}
|
||||
uint16_t* code = jv_mem_alloc(sizeof(uint16_t) * bc->codelen);
|
||||
uint16_t* code = jv_mem_calloc(sizeof(uint16_t), bc->codelen);
|
||||
bc->code = code;
|
||||
pos = 0;
|
||||
jv constant_pool = jv_array();
|
||||
@@ -1386,7 +1386,7 @@ int block_compile(block b, struct bytecode** out, struct locfile* lf, jv args) {
|
||||
bc->globals = jv_mem_alloc(sizeof(struct symbol_table));
|
||||
int ncfunc = count_cfunctions(b);
|
||||
bc->globals->ncfunctions = 0;
|
||||
bc->globals->cfunctions = jv_mem_alloc(sizeof(struct cfunction) * ncfunc);
|
||||
bc->globals->cfunctions = jv_mem_calloc(sizeof(struct cfunction), ncfunc);
|
||||
bc->globals->cfunc_names = jv_array();
|
||||
bc->debuginfo = jv_object_set(jv_object(), jv_string("name"), jv_null());
|
||||
jv env = jv_invalid();
|
||||
|
||||
Reference in new issue
Block a user