diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2026-05-08 11:29:44 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu.nakada@gmail.com> | 2026-05-08 13:49:15 +0900 |
| commit | 216c49f5d35fc9054188175be2640b97033253b7 (patch) | |
| tree | 10d4901725b10ac3208d9038510cee4880564c8d | |
| parent | af7605d3c818ddb488bba74c9e6a86115915aabf (diff) | |
Use macros for specific purposes
| -rw-r--r-- | file.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -3921,7 +3921,7 @@ copy_home_path(VALUE result, const char *dir) memcpy(buf = RSTRING_PTR(result), dir, dirlen); encidx = rb_filesystem_encindex(); rb_enc_associate_index(result, encidx); -#if defined DOSISH || defined __CYGWIN__ +#if defined FILE_ALT_SEPARATOR rb_encoding *enc = rb_enc_from_index(encidx); bool mb_enc = enc_mbclen_needed(enc); for (char *p = buf, *bend = p + dirlen; p < bend; Inc(p, bend, mb_enc, enc)) { @@ -4169,14 +4169,14 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na BUFINIT(); p = e; } -#if defined DOSISH || defined __CYGWIN__ +#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC if (s < fend && isdirsep(*s)) { /* specified full path, but not drive letter nor UNC */ /* we need to get the drive letter or UNC share name */ p = skipprefix(buf, p, mb_enc, enc); } else -#endif /* defined DOSISH || defined __CYGWIN__ */ +#endif /* defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC */ p = chompdirsep(skiproot(buf, p), p, mb_enc, enc); } else { @@ -4233,8 +4233,8 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na #endif /* USE_NTFS */ break; case '/': -#if defined DOSISH || defined __CYGWIN__ - case '\\': +#if defined FILE_ALT_SEPARATOR + case FILE_ALT_SEPARATOR: #endif b = ++s; break; @@ -4258,8 +4258,8 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na #endif /* USE_NTFS */ break; case '/': -#if defined DOSISH || defined __CYGWIN__ - case '\\': +#if defined FILE_ALT_SEPARATOR + case FILE_ALT_SEPARATOR: #endif if (s > b) { WITH_ROOTDIFF(BUFCOPY(b, s-b)); |
