mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 08:25:20 +08:00
Remove CharNext from eval_intern.h
ruby_push_include was its last user. A path separator never appears inside a multibyte character, so walk RUBYLIB and -I by bytes everywhere. This also fixes the same skipped separator on Cygwin, where CharNext came from windows.h. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
10eee53bd5
commit
cd3657cf06
2 files changed
+2
-26
Notes:
git
2026-09-26 23:26:46 +00:00
No files matched your search
@@ -353,21 +353,4 @@ VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
|
||||
VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
|
||||
VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n, bool skip_internal);
|
||||
|
||||
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
||||
# ifdef HAVE_MBLEN
|
||||
# define CharNext(p) rb_char_next(p)
|
||||
static inline char *
|
||||
rb_char_next(const char *p)
|
||||
{
|
||||
if (p) {
|
||||
int len = mblen(p, RUBY_MBCHAR_MAXSIZE);
|
||||
p += len > 0 ? len : 1;
|
||||
}
|
||||
return (char *)p;
|
||||
}
|
||||
# else
|
||||
# define CharNext(p) ((p) + 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* RUBY_EVAL_INTERN_H */
|
||||
@@ -454,13 +454,6 @@ ruby_push_include(const char *path, VALUE (*filter)(VALUE))
|
||||
# define is_path_sep(c) ((c) == sep || (c) == ';')
|
||||
#else
|
||||
# define is_path_sep(c) ((c) == sep)
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
/* RUBYLIB and -I are UTF-8 while CharNext() follows the ANSI code
|
||||
* page, and neither has the separator in a multibyte character. */
|
||||
# define next_char(s) ((s) + 1)
|
||||
#else
|
||||
# define next_char(s) CharNext(s)
|
||||
#endif
|
||||
|
||||
if (path == 0) return;
|
||||
@@ -470,10 +463,10 @@ ruby_push_include(const char *path, VALUE (*filter)(VALUE))
|
||||
while (is_path_sep(*p))
|
||||
p++;
|
||||
if (!*p) break;
|
||||
for (s = p; *s && !is_path_sep(*s); s = next_char(s));
|
||||
/* separators never appear inside a multibyte character */
|
||||
for (s = p; *s && !is_path_sep(*s); s++);
|
||||
len = s - p;
|
||||
#undef is_path_sep
|
||||
#undef next_char
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
if (*s) {
|
||||
|
||||
Reference in new issue
Block a user