summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authordearblue <[email protected]>2020-04-24 21:15:34 +0900
committerdearblue <[email protected]>2020-04-24 21:32:35 +0900
commit26eb29547b6e2c5b94ec1bf4b0e90a7821b04be1 (patch)
tree281aa41711386929f4ffe46ab6deccf2bdae5226 /include
parentd3a02a297f5a2a7a7f5951168bd837e3733a3071 (diff)
downloadmruby-26eb29547b6e2c5b94ec1bf4b0e90a7821b04be1.tar.gz
mruby-26eb29547b6e2c5b94ec1bf4b0e90a7821b04be1.zip
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()); ```
Diffstat (limited to 'include')
-rw-r--r--include/mruby/array.h1
1 files changed, 1 insertions, 0 deletions
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);