diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-03 15:38:58 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-03 15:38:58 +0000 |
commit | 4e273f76763d783852a01e58feb81e6e074d671f (patch) | |
tree | 58c936f7ac27659d101e0ac9a2266a56475c385c /dir.c | |
parent | fdde6957f7d1cff1fc550ab5d4be141aae443eb9 (diff) |
Revert r36279; it breaks C API compatibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -910,16 +910,11 @@ check_dirname(volatile VALUE *dir) { VALUE d = *dir; char *path, *pend; - long len; - rb_encoding *enc; rb_secure(2); FilePathValue(d); - enc = rb_enc_get(d); - RSTRING_GETMEM(d, path, len); - pend = path + len; - pend = rb_enc_path_end(rb_enc_path_skip_prefix(path, pend, enc), pend, enc); - if (pend - path < len) { + path = RSTRING_PTR(d); + if (path && *(pend = rb_path_end(rb_path_skip_prefix(path)))) { d = rb_str_subseq(d, 0, pend - path); } *dir = rb_str_encode_ospath(d); @@ -1499,7 +1494,7 @@ ruby_glob0(const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_enco start = root = path; flags |= FNM_SYSCASE; #if defined DOSISH - root = rb_enc_path_skip_prefix(root, root + strlen(root), enc); + root = rb_path_skip_prefix(root); #endif if (root && *root == '/') root++; |