-
Notifications
You must be signed in to change notification settings - Fork 591
Avoid some UTF8SKIPs #23695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: blead
Are you sure you want to change the base?
Avoid some UTF8SKIPs #23695
Conversation
e9eaeea
to
9f6f8a5
Compare
@@ -730,7 +730,7 @@ S_warn_expect_operator(pTHX_ const char *const what, char *s, I32 pop_oldbufptr) | |||
const char *t= oldbp; | |||
assert(s >= oldbp); | |||
while (t < s && isSPACE(*t)) { | |||
t += UTF ? UTF8SKIP(t) : 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 707 too.
Wouldn't t++
be more typical than t += 1
? (below too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 707 too.
nm, it's in #23698
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonetheless, I shouldn't be introducing non-idiomatic code at all. Changed
This value is returnable from the called function. Use it instead of re-deriving it
This value is returnable from the called function. Use it instead of re-deriving it
This value is returnable from the called functions. Use it instead of re-deriving it
If a character matches isSPACE, it must be an ASCII character, and hence its length is 1. No need check for and call UTF8SKIP on it.
This value is returnable from the called functions. Use it instead of re-deriving it
8ade822
to
ea90d42
Compare
This value is returnable from the called functions. And those functions have actually verified every byte that comprises the code point, so it is safer and better practice to use this value, instead of UTF8SKIP, which looks just at the first byte.