diff --git a/include/picrin.h b/include/picrin.h index 91ca2921..955dac01 100644 --- a/include/picrin.h +++ b/include/picrin.h @@ -11,7 +11,7 @@ struct pic_code; -typedef struct pic_callinfo { +typedef struct { int argc; struct pic_code *pc; pic_value *fp; diff --git a/include/picrin/proc.h b/include/picrin/proc.h index e92ad6c8..d1ca2aab 100644 --- a/include/picrin/proc.h +++ b/include/picrin/proc.h @@ -4,7 +4,7 @@ struct pic_env { PIC_OBJECT_HEADER pic_value *values; - int num_val; + int valuec; struct pic_env *up; }; diff --git a/src/gc.c b/src/gc.c index c717e608..d95dd01f 100644 --- a/src/gc.c +++ b/src/gc.c @@ -159,7 +159,7 @@ gc_mark_object(pic_state *pic, struct pic_object *obj) struct pic_env *env = (struct pic_env *)obj; int i; - for (i = 0; i < env->num_val; ++i) { + for (i = 0; i < env->valuec; ++i) { gc_mark(pic, env->values[i]); } if (env->up) { diff --git a/src/vm.c b/src/vm.c index c52eb707..2271dd2e 100644 --- a/src/vm.c +++ b/src/vm.c @@ -370,9 +370,9 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv) /* prepare env */ ci->env = (struct pic_env *)pic_obj_alloc(pic, sizeof(struct pic_env), PIC_TT_ENV); ci->env->up = proc->env; - ci->env->num_val = proc->u.irep->argc + proc->u.irep->localc; - ci->env->values = (pic_value *)pic_calloc(pic, ci->env->num_val, sizeof(pic_value)); - for (i = 0; i < ci->env->num_val; ++i) { + ci->env->valuec = proc->u.irep->argc + proc->u.irep->localc; + ci->env->values = (pic_value *)pic_calloc(pic, ci->env->valuec, sizeof(pic_value)); + for (i = 0; i < ci->env->valuec; ++i) { ci->env->values[i] = ci->fp[i]; }