Reduce object allocation
MODIFY
mrbgems/mruby-proc-ext/src/proc.c
mrbgems/mruby-proc-ext/src/proc.c
@@ -110,7 +110,7 @@ mrb_proc_parameters(mrb_state *mrb, mrb_value self)
const struct RProc *proc = mrb_proc_ptr(self);
const struct mrb_irep *irep = proc->body.irep;
mrb_aspec aspec;
- mrb_value parameters;
+ mrb_value sname, parameters;
int i, j;
if (MRB_PROC_CFUNC_P(proc)) {
@@ -142,7 +142,8 @@ mrb_proc_parameters(mrb_state *mrb, mrb_value self)
parameters = mrb_ary_new_capa(mrb, irep->nlocals-1);
for (i = 0, p = parameters_list; p->name; p++) {
- mrb_value sname = mrb_symbol_value(mrb_intern_cstr(mrb, p->name));
+ if (p->size <= 0) continue;
+ sname = mrb_symbol_value(mrb_intern_cstr(mrb, p->name));
for (j = 0; j < p->size; i++, j++) {
mrb_value a = mrb_ary_new(mrb);
mrb_ary_push(mrb, a, sname);

Reduce object allocation