s/pic_alloc/pic_malloc/g

This commit is contained in:
Yuichi Nishiwaki 2015-05-28 16:42:16 +09:00
parent 278075910a
commit 6a692541a6
14 changed files with 29 additions and 30 deletions

View File

@ -117,36 +117,36 @@ save_cont(pic_state *pic, struct pic_cont **c)
pic_vm_tear_off(pic); /* tear off */
cont = *c = pic_alloc(pic, sizeof(struct pic_cont));
cont = *c = pic_malloc(pic, sizeof(struct pic_cont));
cont->wind = pic->wind;
cont->stk_len = native_stack_length(pic, &pos);
cont->stk_pos = pos;
assert(cont->stk_len > 0);
cont->stk_ptr = pic_alloc(pic, cont->stk_len);
cont->stk_ptr = pic_malloc(pic, cont->stk_len);
memcpy(cont->stk_ptr, cont->stk_pos, cont->stk_len);
cont->sp_offset = pic->sp - pic->stbase;
cont->st_len = pic->stend - pic->stbase;
cont->st_ptr = pic_alloc(pic, sizeof(pic_value) * cont->st_len);
cont->st_ptr = pic_malloc(pic, sizeof(pic_value) * cont->st_len);
memcpy(cont->st_ptr, pic->stbase, sizeof(pic_value) * cont->st_len);
cont->ci_offset = pic->ci - pic->cibase;
cont->ci_len = pic->ciend - pic->cibase;
cont->ci_ptr = pic_alloc(pic, sizeof(pic_callinfo) * cont->ci_len);
cont->ci_ptr = pic_malloc(pic, sizeof(pic_callinfo) * cont->ci_len);
memcpy(cont->ci_ptr, pic->cibase, sizeof(pic_callinfo) * cont->ci_len);
cont->xp_offset = pic->xp - pic->xpbase;
cont->xp_len = pic->xpend - pic->xpbase;
cont->xp_ptr = pic_alloc(pic, sizeof(struct pic_proc *) * cont->xp_len);
cont->xp_ptr = pic_malloc(pic, sizeof(struct pic_proc *) * cont->xp_len);
memcpy(cont->xp_ptr, pic->xpbase, sizeof(struct pic_proc *) * cont->xp_len);
cont->ip = pic->ip;
cont->arena_idx = pic->arena_idx;
cont->arena_size = pic->arena_size;
cont->arena = pic_alloc(pic, sizeof(struct pic_object *) * pic->arena_size);
cont->arena = pic_malloc(pic, sizeof(struct pic_object *) * pic->arena_size);
memcpy(cont->arena, pic->arena, sizeof(struct pic_object *) * pic->arena_size);
cont->results = pic_undef_value();

View File

@ -54,7 +54,7 @@ pic_regexp_regexp(pic_state *pic)
}
}
reg = pic_alloc(pic, sizeof(struct pic_regexp_t));
reg = pic_malloc(pic, sizeof(struct pic_regexp_t));
reg->flags = flags;
if ((err = regcomp(&reg->reg, ptrn, cflags)) != 0) {

View File

@ -12,7 +12,7 @@ pic_make_blob(pic_state *pic, size_t len)
struct pic_blob *bv;
bv = (struct pic_blob *)pic_obj_alloc(pic, sizeof(struct pic_blob), PIC_TT_BLOB);
bv->data = pic_alloc(pic, len);
bv->data = pic_malloc(pic, len);
bv->len = len;
return bv;
}

View File

@ -70,7 +70,7 @@ new_analyze_state(pic_state *pic)
pic_sym *sym;
xh_entry *it;
state = pic_alloc(pic, sizeof(analyze_state));
state = pic_malloc(pic, sizeof(analyze_state));
state->pic = pic;
state->scope = NULL;
@ -144,7 +144,7 @@ static bool
push_scope(analyze_state *state, pic_value formals)
{
pic_state *pic = state->pic;
analyze_scope *scope = pic_alloc(pic, sizeof(analyze_scope));
analyze_scope *scope = pic_malloc(pic, sizeof(analyze_scope));
bool varg;
xv_init(scope->args);
@ -900,7 +900,7 @@ new_codegen_state(pic_state *pic)
{
codegen_state *state;
state = pic_alloc(pic, sizeof(codegen_state));
state = pic_malloc(pic, sizeof(codegen_state));
state->pic = pic;
state->cxt = NULL;
@ -1026,7 +1026,7 @@ push_codegen_context(codegen_state *state, pic_value name, pic_value args, pic_v
assert(pic_sym_p(name) || pic_false_p(name));
cxt = pic_alloc(pic, sizeof(codegen_context));
cxt = pic_malloc(pic, sizeof(codegen_context));
cxt->up = state->cxt;
cxt->name = pic_false_p(name)
? pic_intern_cstr(pic, "(anonymous lambda)")

View File

@ -36,7 +36,7 @@ pic_dynamic_wind(pic_state *pic, struct pic_proc *in, struct pic_proc *thunk, st
}
here = pic->wind;
pic->wind = pic_alloc(pic, sizeof(struct pic_winder));
pic->wind = pic_malloc(pic, sizeof(struct pic_winder));
pic->wind->prev = here;
pic->wind->depth = here->depth + 1;
pic->wind->in = in;
@ -128,7 +128,7 @@ pic_make_econt(pic_state *pic, struct pic_escape *escape)
pic_value
pic_escape(pic_state *pic, struct pic_proc *proc)
{
struct pic_escape *escape = pic_alloc(pic, sizeof(struct pic_escape));
struct pic_escape *escape = pic_malloc(pic, sizeof(struct pic_escape));
pic_save_point(pic, escape);

View File

@ -170,7 +170,7 @@ pic_dict_dictionary_map(pic_state *pic)
pic_get_args(pic, "l*", &proc, &argc, &args);
it = pic_alloc(pic, argc * sizeof(xh_entry));
it = pic_malloc(pic, argc * sizeof(xh_entry));
for (i = 0; i < argc; ++i) {
if (! pic_dict_p(args[i])) {
pic_free(pic, it);
@ -217,7 +217,7 @@ pic_dict_dictionary_for_each(pic_state *pic)
pic_get_args(pic, "l*", &proc, &argc, &args);
it = pic_alloc(pic, argc * sizeof(xh_entry));
it = pic_malloc(pic, argc * sizeof(xh_entry));
for (i = 0; i < argc; ++i) {
if (! pic_dict_p(args[i])) {
pic_free(pic, it);

View File

@ -104,7 +104,7 @@ add_heap_page(pic_state *pic)
up->s.size = 1;
up->s.ptr = np;
page = pic_alloc(pic, sizeof(struct heap_page));
page = pic_malloc(pic, sizeof(struct heap_page));
page->basep = up;
page->endp = up + nu + 1;
page->next = pic->heap->pages;
@ -131,7 +131,7 @@ pic_default_allocf(void *ptr, size_t size)
#endif
void *
pic_alloc(pic_state *pic, size_t size)
pic_malloc(pic_state *pic, size_t size)
{
void *ptr;

View File

@ -151,8 +151,7 @@ typedef struct {
typedef pic_value (*pic_func_t)(pic_state *);
void *pic_alloc(pic_state *, size_t);
#define pic_malloc(pic,size) pic_alloc(pic,size) /* obsoleted */
void *pic_malloc(pic_state *, size_t);
void *pic_realloc(pic_state *, void *, size_t);
void *pic_calloc(pic_state *, size_t, size_t);
struct pic_object *pic_obj_alloc(pic_state *, size_t, enum pic_tt);

View File

@ -32,7 +32,7 @@ struct pic_error *pic_make_error(pic_state *, pic_sym *, const char *, pic_list)
pic_catch_(PIC_GENSYM(label))
#define pic_try_(escape) \
do { \
struct pic_escape *escape = pic_alloc(pic, sizeof(struct pic_escape)); \
struct pic_escape *escape = pic_malloc(pic, sizeof(struct pic_escape)); \
pic_save_point(pic, escape); \
if (PIC_SETJMP(pic, (void *)escape->jmp) == 0) { \
pic_push_try(pic, escape); \

View File

@ -197,7 +197,7 @@ pic_get_output_string(pic_state *pic, struct pic_port *port)
xrewind(port->file);
/* copy to buf */
buf = (char *)pic_alloc(pic, size + 1);
buf = (char *)pic_malloc(pic, size + 1);
buf[size] = 0;
xfread(buf, size, 1, port->file);

View File

@ -208,7 +208,7 @@ read_symbol(pic_state *pic, struct pic_port *port, int c)
pic_sym *sym;
len = 1;
buf = pic_alloc(pic, len + 1);
buf = pic_malloc(pic, len + 1);
buf[0] = case_fold(pic, c);
buf[1] = 0;
@ -468,7 +468,7 @@ read_string(pic_state *pic, struct pic_port *port, int c)
pic_str *str;
size = 256;
buf = pic_alloc(pic, size);
buf = pic_malloc(pic, size);
cnt = 0;
/* TODO: intraline whitespaces */
@ -506,7 +506,7 @@ read_pipe(pic_state *pic, struct pic_port *port, int c)
size_t i = 0;
size = 256;
buf = pic_alloc(pic, size);
buf = pic_malloc(pic, size);
cnt = 0;
while ((c = next(port)) != '|') {
if (c == '\\') {
@ -830,7 +830,7 @@ pic_reader_open(pic_state *pic)
struct pic_reader *reader;
int c;
reader = pic_alloc(pic, sizeof(struct pic_reader));
reader = pic_malloc(pic, sizeof(struct pic_reader));
reader->typecase = PIC_CASE_DEFAULT;
xh_init_int(&reader->labels, sizeof(pic_value));

View File

@ -318,7 +318,7 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
pic->macros = pic_make_dict(pic);
/* root block */
pic->wind = pic_alloc(pic, sizeof(struct pic_winder));
pic->wind = pic_malloc(pic, sizeof(struct pic_winder));
pic->wind->prev = NULL;
pic->wind->depth = 0;
pic->wind->in = pic->wind->out = NULL;

View File

@ -465,7 +465,7 @@ pic_str_string(pic_state *pic)
pic_get_args(pic, "*", &argc, &argv);
buf = pic_alloc(pic, (size_t)argc);
buf = pic_malloc(pic, (size_t)argc);
for (i = 0; i < argc; ++i) {
pic_assert_type(pic, argv[i], char);

View File

@ -15,7 +15,7 @@ pic_make_vec(pic_state *pic, size_t len)
vec = (struct pic_vector *)pic_obj_alloc(pic, sizeof(struct pic_vector), PIC_TT_VECTOR);
vec->len = len;
vec->data = (pic_value *)pic_alloc(pic, sizeof(pic_value) * len);
vec->data = (pic_value *)pic_malloc(pic, sizeof(pic_value) * len);
for (i = 0; i < len; ++i) {
vec->data[i] = pic_none_value();
}
@ -363,7 +363,7 @@ pic_vec_vector_to_string(pic_state *pic)
pic_errorf(pic, "vector->string: end index must not be less than start index");
}
buf = pic_alloc(pic, end - start);
buf = pic_malloc(pic, end - start);
for (i = start; i < end; ++i) {
pic_assert_type(pic, vec->data[i], char);