Skip to content

Commit 240a58e

Browse files
committed
file.c: skiproot doesn't need encoding
1 parent 11d29d3 commit 240a58e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

file.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,7 +3636,7 @@ not_same_drive(VALUE path, int drive)
36363636
#endif /* DOSISH_DRIVE_LETTER */
36373637

36383638
static inline char *
3639-
skiproot(const char *path, const char *end, rb_encoding *enc)
3639+
skiproot(const char *path, const char *end)
36403640
{
36413641
#ifdef DOSISH_DRIVE_LETTER
36423642
if (path + 2 <= end && has_drive_letter(path)) path += 2;
@@ -3689,7 +3689,7 @@ skipprefixroot(const char *path, const char *end, rb_encoding *enc)
36893689
while (isdirsep(*p)) p++;
36903690
return p;
36913691
#else
3692-
return skiproot(path, end, enc);
3692+
return skiproot(path, end);
36933693
#endif
36943694
}
36953695

@@ -4075,7 +4075,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
40754075
rb_enc_associate(result, enc = fs_enc_check(result, fname));
40764076
p = pend;
40774077
}
4078-
p = chompdirsep(skiproot(buf, p, enc), p, enc);
4078+
p = chompdirsep(skiproot(buf, p), p, enc);
40794079
s += 2;
40804080
}
40814081
}
@@ -4100,7 +4100,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
41004100
}
41014101
else
41024102
#endif /* defined DOSISH || defined __CYGWIN__ */
4103-
p = chompdirsep(skiproot(buf, p, enc), p, enc);
4103+
p = chompdirsep(skiproot(buf, p), p, enc);
41044104
}
41054105
else {
41064106
size_t len;
@@ -4231,7 +4231,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
42314231
BUFCOPY(b, s-b);
42324232
rb_str_set_len(result, p-buf);
42334233
}
4234-
if (p == skiproot(buf, p + !!*p, enc) - 1) p++;
4234+
if (p == skiproot(buf, p + !!*p) - 1) p++;
42354235

42364236
#if USE_NTFS
42374237
*p = '\0';
@@ -5081,7 +5081,7 @@ rb_file_dirname_n(VALUE fname, int n)
50815081
CheckPath(fname, name);
50825082
end = name + RSTRING_LEN(fname);
50835083
enc = path_enc_get(fname);
5084-
root = skiproot(name, end, enc);
5084+
root = skiproot(name, end);
50855085
#ifdef DOSISH_UNC
50865086
if (root > name + 1 && isdirsep(*name))
50875087
root = skipprefix(name = root - 2, end, enc);
@@ -5133,7 +5133,7 @@ rb_file_dirname_n(VALUE fname, int n)
51335133
}
51345134
#ifdef DOSISH_DRIVE_LETTER
51355135
if (has_drive_letter(name) && isdirsep(*(name + 2))) {
5136-
const char *top = skiproot(name + 2, end, enc);
5136+
const char *top = skiproot(name + 2, end);
51375137
dirname = rb_enc_str_new(name, 3, rb_str_enc_get(fname));
51385138
rb_str_cat(dirname, top, p - top);
51395139
}

0 commit comments

Comments
 (0)