summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-17 16:10:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-17 16:10:53 +0000
commit22cfbc23710c9636248e1ddbdaf0ba34b28b46fa (patch)
tree5c553c60933498cf9fccb17604155dedcd3bf81c /file.c
parent273c4d116b1f6ac393b4fd34895f59b24045cfd9 (diff)
* file.c (rb_file_join): convert components by to_s instead of to_str.
fixed: [ruby-dev:27127] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/file.c b/file.c
index 937b17f331..4e58a538c9 100644
--- a/file.c
+++ b/file.c
@@ -2703,13 +2703,10 @@ static VALUE
rb_file_join(VALUE ary, VALUE sep)
{
long len, i;
- int taint = 0;
VALUE result, tmp;
char *name, *tail;
if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
- if (OBJ_TAINTED(ary)) taint = 1;
- if (OBJ_TAINTED(sep)) taint = 1;
len = 1;
for (i=0; i<RARRAY(ary)->len; i++) {
@@ -2724,6 +2721,7 @@ rb_file_join(VALUE ary, VALUE sep)
len += RSTRING(sep)->len * RARRAY(ary)->len - 1;
}
result = rb_str_buf_new(len);
+ OBJ_INFECT(result, ary);
for (i=0; i<RARRAY(ary)->len; i++) {
tmp = RARRAY(ary)->ptr[i];
switch (TYPE(tmp)) {
@@ -2739,7 +2737,7 @@ rb_file_join(VALUE ary, VALUE sep)
}
break;
default:
- StringValueCStr(tmp);
+ tmp = rb_obj_as_string(tmp);
}
name = StringValueCStr(result);
if (i > 0 && !NIL_P(sep)) {
@@ -2752,10 +2750,8 @@ rb_file_join(VALUE ary, VALUE sep)
}
}
rb_str_buf_append(result, tmp);
- if (OBJ_TAINTED(tmp)) taint = 1;
}
- if (taint) OBJ_TAINT(result);
return result;
}
@@ -2828,7 +2824,6 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
#endif
return INT2FIX(0);
}
- int recur;
/*
* call-seq: