diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2026-01-19 08:56:41 +0100 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2026-01-20 08:33:42 +0100 |
| commit | 990cf1286a165588c5b2f4d4fa98bb9d45c8fd11 (patch) | |
| tree | d2ff3136a54663fc2902949f67a26b3586f829d5 | |
| parent | 240a58ecc63d07b50ddfb027a9c9b9bc317ffc49 (diff) | |
file.c: Inc macro now handle NULL encoding
| -rw-r--r-- | file.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -3571,7 +3571,7 @@ static const char file_alt_separator[] = {FILE_ALT_SEPARATOR, '\0'}; # define isADS(x) 0 #endif -#define Next(p, e, enc) ((p) + rb_enc_mbclen((p), (e), (enc))) +#define Next(p, e, enc) ((p) + ((enc) ? rb_enc_mbclen((p), (e), (enc)) : 1)) #define Inc(p, e, enc) ((p) = Next((p), (e), (enc))) #if defined(DOSISH_UNC) @@ -5114,12 +5114,7 @@ rb_file_dirname_n(VALUE fname, int n) if (i == n) i = 0; } else { - if (RB_UNLIKELY(enc)) { - Inc(p, end, enc); - } - else { - p++; - } + Inc(p, end, enc); } } p = seps[i]; |
