From ca4de06e60c684fca8892623c18631165f191442 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Sat, 2 Jun 2012 21:05:33 +0900 Subject: avoid using mrb_value in Array#+ --- src/array.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/array.c b/src/array.c index eaead08b3..27e8e9aba 100644 --- a/src/array.c +++ b/src/array.c @@ -191,15 +191,16 @@ mrb_ary_plus(mrb_state *mrb, mrb_value self) { struct RArray *a1 = mrb_ary_ptr(self); struct RArray *a2; - mrb_value other; mrb_value ary; + mrb_value *buf; + int blen; - mrb_get_args(mrb, "A", &other); - ary = mrb_ary_new_capa(mrb, a1->len + RARRAY_LEN(other)); + mrb_get_args(mrb, "a", &buf, &blen); + ary = mrb_ary_new_capa(mrb, a1->len + blen); a2 = mrb_ary_ptr(ary); memcpy(a2->buf, a1->buf, sizeof(mrb_value)*a1->len); - memcpy(a2->buf + a1->len, RARRAY_PTR(other), sizeof(mrb_value)*RARRAY_LEN(other)); - a2->len = a1->len + RARRAY_LEN(other); + memcpy(a2->buf + a1->len, buf, sizeof(mrb_value)*blen); + a2->len = a1->len + blen; return ary; } -- cgit v1.2.3