Skip to content

Commit

Permalink
Merge pull request #741 from nobu/ctype-plain-char
Browse files Browse the repository at this point in the history
Avoid plain char for ctype macros
  • Loading branch information
nobu authored Jan 30, 2025
2 parents f3fb8a2 + 4431b36 commit 1023227
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/json/ext/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static VALUE rstring_cache_fetch(rvalue_cache *cache, const char *str, const lon
return Qfalse;
}

if (RB_UNLIKELY(!isalpha(str[0]))) {
if (RB_UNLIKELY(!isalpha((unsigned char)str[0]))) {
// Simple heuristic, if the first character isn't a letter,
// we're much less likely to see this string again.
// We mostly want to cache strings that are likely to be repeated.
Expand Down Expand Up @@ -187,7 +187,7 @@ static VALUE rsymbol_cache_fetch(rvalue_cache *cache, const char *str, const lon
return Qfalse;
}

if (RB_UNLIKELY(!isalpha(str[0]))) {
if (RB_UNLIKELY(!isalpha((unsigned char)str[0]))) {
// Simple heuristic, if the first character isn't a letter,
// we're much less likely to see this string again.
// We mostly want to cache strings that are likely to be repeated.
Expand Down

0 comments on commit 1023227

Please sign in to comment.