summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-27 14:47:20 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-27 14:47:20 +0000
commitac8346c4c3031126b455bf71e6a7381dd0378386 (patch)
treeedd64f00893568bcb7958fdb287c79d30f5cbfe3 /file.c
parentf39ad4cab2f2d1c977aa4b4356a3a42c11d1d03d (diff)
* file.c (file_expand_path): use rb_enc_associate_index and
rb_filesystem_encindex. Strings related FileSystem should have filesystem_encoding. * file.c (SET_EXTERNAL_ENCODING): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28038 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 bc072a93d7..8f1a8a8c64 100644
--- a/file.c
+++ b/file.c
@@ -2788,10 +2788,6 @@ ntfs_tail(const char *path)
buflen = RSTRING_LEN(result),\
pend = p + buflen)
-#define SET_EXTERNAL_ENCODING() (\
- (void)(extenc || (extenc = rb_default_external_encoding())),\
- rb_enc_associate(result, extenc))
-
VALUE
rb_home_dir(const char *user, VALUE result)
{
@@ -2842,7 +2838,6 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
char *buf, *p, *pend, *root;
size_t buflen, dirlen, bdiff;
int tainted;
- rb_encoding *extenc = 0;
s = StringValuePtr(fname);
BUFINIT();
@@ -2898,7 +2893,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
BUFCHECK(dirlen > buflen);
strcpy(buf, dir);
xfree(dir);
- SET_EXTERNAL_ENCODING();
+ rb_enc_associate_index(result, rb_filesystem_encindex());
}
p = chompdirsep(skiproot(buf));
s += 2;
@@ -2918,7 +2913,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
BUFCHECK(dirlen > buflen);
strcpy(buf, dir);
xfree(dir);
- SET_EXTERNAL_ENCODING();
+ rb_enc_associate_index(result, rb_filesystem_encindex());
}
#if defined DOSISH || defined __CYGWIN__
if (isdirsep(*s)) {