diff options
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -780,8 +780,9 @@ reg_names_iter(const OnigUChar *name, const OnigUChar *name_end, static VALUE rb_reg_names(VALUE re) { - VALUE ary = rb_ary_new(); + VALUE ary; rb_reg_check(re); + ary = rb_ary_new_capa(onig_number_of_names(RREGEXP_PTR(re))); onig_foreach_name(RREGEXP_PTR(re), reg_names_iter, (void*)ary); return ary; } |