Skip to content

Commit 1056171

Browse files
committed
S_scan_ident: Avoid a recalculation
Save the value from the first time into a variable
1 parent d35940a commit 1056171

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

toke.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10912,17 +10912,17 @@ S_scan_ident(pTHX_ char *s, char *dest, char *dest_end, U32 flags)
1091210912
else { /* Found a '{' */
1091310913

1091410914
/* Handle the interior of braces. First look to see if the character
10915-
* pointed to by 'd' is legal as the start of an identifier.
10916-
* If it isn't a normal identifier, it could be a control-character
10917-
* one. Those have to be followed by a \w character. Prefer a normal
10918-
* identifier, as UTF-8 strings could erroneously be conflated with a
10919-
* control character identifier. */
10920-
if ( isIDFIRST_lazy_if_safe(d, e, is_utf8)
10921-
|| ( ! isPRINT(*d) /* isCNTRL(d), plus all non-ASCII */
10922-
&& isWORDCHAR(*s))
10923-
) {
10924-
Size_t advance;
10925-
if ((advance = isIDFIRST_lazy_if_safe(d, e, is_utf8) )) {
10915+
* pointed to by 'd' is legal as the start of an identifier. */
10916+
Size_t advance = isIDFIRST_lazy_if_safe(d, e, is_utf8);
10917+
10918+
/* If it isn't a normal identifier, it could be a control-character
10919+
* one. Those have to be followed by a \w character. */
10920+
if (advance || ( ! isPRINT(*d) /* isCNTRL(d), plus all non-ASCII */
10921+
&& isWORDCHAR(*s)))
10922+
{
10923+
/* Prefer a normal identifier, as UTF-8 strings could erroneously
10924+
* be conflated with a control character identifier. */
10925+
if (advance) {
1092610926

1092710927
/* Now parse the normal identifier.
1092810928
*

0 commit comments

Comments
 (0)