Need not to call mrb_obj_as_string() is sep is nil.

parent ce869752
...@@ -1071,7 +1071,9 @@ join_ary(mrb_state *mrb, mrb_value ary, mrb_value sep, mrb_value list) ...@@ -1071,7 +1071,9 @@ join_ary(mrb_state *mrb, mrb_value ary, mrb_value sep, mrb_value list)
MRB_API mrb_value MRB_API mrb_value
mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep) 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)); return join_ary(mrb, ary, sep, mrb_ary_new(mrb));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment