diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-02 21:05:33 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-02 21:05:33 +0900 |
| commit | ca4de06e60c684fca8892623c18631165f191442 (patch) | |
| tree | 625c9b4ec3771a7619f82cc060683bbb8f3edf1e /src/array.c | |
| parent | 98fb528f6f80ade0f08e9a373cb89848bc3ded13 (diff) | |
| download | mruby-ca4de06e60c684fca8892623c18631165f191442.tar.gz mruby-ca4de06e60c684fca8892623c18631165f191442.zip | |
avoid using mrb_value in Array#+
Diffstat (limited to 'src/array.c')
| -rw-r--r-- | src/array.c | 11 |
1 files changed, 6 insertions, 5 deletions
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; } |
