From 35008e2087fd1ef07ad749a75db5417721ef8c69 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 15 Nov 2001 15:56:08 +0000 Subject: * array.c (rb_ary_join): non-nil separator must be converted to String. and separators' total length was wrong. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index 0dfa3aef40..f77cfc7401 100644 --- a/array.c +++ b/array.c @@ -804,8 +804,9 @@ rb_ary_join(ary, sep) len += 10; } } - if (!NIL_P(sep) && TYPE(sep) == T_STRING) { - len += RSTRING(sep)->len * RARRAY(ary)->len - 1; + if (!NIL_P(sep)) { + StringValue(sep); + len += RSTRING(sep)->len * (RARRAY(ary)->len - 1); } result = rb_str_buf_new(len); for (i=0; ilen; i++) { -- cgit v1.2.3