diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-15 15:56:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-15 15:56:08 +0000 |
commit | 8b26ade46222279569270ae9f178d6fa30b7842d (patch) | |
tree | 0203917a0867aeb9d08babd0a7f3333d6a054428 /array.c | |
parent | a34c7d427fc0088b0ae007159e7ffc8ef1981119 (diff) | |
download | ruby-8b26ade46222279569270ae9f178d6fa30b7842d.tar.gz ruby-8b26ade46222279569270ae9f178d6fa30b7842d.tar.xz ruby-8b26ade46222279569270ae9f178d6fa30b7842d.zip |
* array.c (rb_ary_join): non-nil separator must be converted to
String. and separators' total length was wrong.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; i<RARRAY(ary)->len; i++) { |