From 26eb29547b6e2c5b94ec1bf4b0e90a7821b04be1 Mon Sep 17 00:00:00 2001 From: dearblue Date: Fri, 24 Apr 2020 21:15:34 +0900 Subject: Support `undef` for `mrb_ary_splice()` instead of `[]` When removing elements from an array, it is possible to avoid creating an empty array. Before this patch: ```c mrb_ary_splice(mrb, ary, head, len, mrb_ary_new(mrb)); ``` After this patch: ```c mrb_ary_splice(mrb, ary, head, len, mrb_undef_value()); ``` --- include/mruby/array.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/mruby/array.h b/include/mruby/array.h index e2dd9bb1c..fd4094a02 100644 --- a/include/mruby/array.h +++ b/include/mruby/array.h @@ -239,6 +239,7 @@ MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset); * @param head Beginning position of a replacement subsequence. * @param len Length of a replacement subsequence. * @param rpl The array of replacement elements. + * It is possible to pass `mrb_undef_value()` instead of an empty array. * @return The receiver array. */ MRB_API mrb_value mrb_ary_splice(mrb_state *mrb, mrb_value self, mrb_int head, mrb_int len, mrb_value rpl); -- cgit v1.2.3