diff --git a/ChangeLog b/ChangeLog index b912141ba4..486e09ddbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Nov 15 15:29:39 2001 Nobuyoshi Nakada + + * array.c (rb_ary_join): non-nil separator must be converted to + String. and separators' total length was wrong. + Thu Nov 15 03:37:17 2001 Usaku Nakamura * hash.c (ruby_setenv): remove USE_WIN32_RTL_ENV block since it's 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++) {