use C malloc instead of pic_alloc

This commit is contained in:
Yuichi Nishiwaki 2013-10-13 16:01:40 +09:00
parent e3600a65c9
commit c250d3b07f
2 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,5 @@
#include <string.h>
#include <stdlib.h>
#include "picrin.h"
@ -12,7 +13,7 @@ pic_intern_cstr(pic_state *pic, const char *name)
/* clone name string */
len = strlen(name);
sym->name = (char *)pic_alloc(pic, len + 1);
sym->name = (char *)malloc(len + 1);
strncpy(sym->name, name, len + 1);
return pic_obj_value(sym);

View File

@ -161,7 +161,7 @@ pic_codegen(pic_state *pic, pic_value obj, struct pic_env *env)
struct pic_irep *irep;
struct pic_code *code;
proc = pic_alloc(pic, sizeof(struct pic_proc));
proc = (struct pic_proc *)malloc(sizeof(struct pic_proc));
proc->u.irep = irep = (struct pic_irep *)malloc(sizeof(struct pic_irep));
irep->code = code = (struct pic_code *)malloc(sizeof(struct pic_code) * 1024);