Skip to content

Conversation

khwilliamson
Copy link
Contributor

@khwilliamson khwilliamson commented Sep 8, 2025

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.

  • This set of changes does not require a perldelta entry.

@khwilliamson khwilliamson changed the title regcomp.c: Avoid a UTF8SKIP Avoid some UTF8SKIPs Sep 8, 2025
@@ -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;
Copy link
Contributor

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)

Copy link
Contributor

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

Copy link
Contributor Author

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
@khwilliamson khwilliamson added the Use merge commit Don't merge this p.r. from github It contains multiple related commits. Instructions in perlgit label Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Use merge commit Don't merge this p.r. from github It contains multiple related commits. Instructions in perlgit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants