summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-05-27 21:43:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-05-27 21:43:43 +0900
commit48b08fecba0b4dea58b8e9b0b473f47848f2fcf0 (patch)
treeb4250613d194c2506afb22600e5764ad71733126 /mrbgems/mruby-array-ext
parent9a72869043e0377ec549a325a074e592f82ef5ed (diff)
downloadmruby-48b08fecba0b4dea58b8e9b0b473f47848f2fcf0.tar.gz
mruby-48b08fecba0b4dea58b8e9b0b473f47848f2fcf0.zip
array.c: unify `mrb_ary_ref` and `mrb_ary_entry`
Use only `mrb_ary_entry` hereafter.
Diffstat (limited to 'mrbgems/mruby-array-ext')
-rw-r--r--mrbgems/mruby-array-ext/src/array.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mrbgems/mruby-array-ext/src/array.c b/mrbgems/mruby-array-ext/src/array.c
index d6ec50672..d97778642 100644
--- a/mrbgems/mruby-array-ext/src/array.c
+++ b/mrbgems/mruby-array-ext/src/array.c
@@ -95,6 +95,12 @@ mrb_ary_at(mrb_state *mrb, mrb_value ary)
}
static mrb_value
+ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n)
+{
+ return mrb_ary_entry(ary, n);
+}
+
+static mrb_value
mrb_ary_values_at(mrb_state *mrb, mrb_value self)
{
mrb_int argc;
@@ -102,10 +108,9 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self)
mrb_get_args(mrb, "*", &argv, &argc);
- return mrb_get_values_at(mrb, self, RARRAY_LEN(self), argc, argv, mrb_ary_ref);
+ return mrb_get_values_at(mrb, self, RARRAY_LEN(self), argc, argv, ary_ref);
}
-
/*
* call-seq:
* ary.slice!(index) -> obj or nil