summaryrefslogtreecommitdiffhomepage
path: root/src/array.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-03-18 22:38:45 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-03-19 00:28:52 +0900
commit6db38c376880651b76263b16788c36c6c9ea3aef (patch)
tree363b70a3571a81437f238829ecad7436e160e25b /src/array.c
parentce8697523f2f0fa5c4c9a565a635e98df8282385 (diff)
downloadmruby-6db38c376880651b76263b16788c36c6c9ea3aef.tar.gz
mruby-6db38c376880651b76263b16788c36c6c9ea3aef.zip
Need not to call mrb_obj_as_string() is sep is nil.
Diffstat (limited to 'src/array.c')
-rw-r--r--src/array.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/array.c b/src/array.c
index c7499ab36..e3381e213 100644
--- a/src/array.c
+++ b/src/array.c
@@ -1071,7 +1071,9 @@ join_ary(mrb_state *mrb, mrb_value ary, mrb_value sep, mrb_value list)
MRB_API mrb_value
mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep)
{
- sep = mrb_obj_as_string(mrb, sep);
+ if (!mrb_nil_p(sep)) {
+ sep = mrb_obj_as_string(mrb, sep);
+ }
return join_ary(mrb, ary, sep, mrb_ary_new(mrb));
}