summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorTAKAI Kousuke <62541129+t-a-k@users.noreply.github.com>2020-10-23 01:07:16 +0900
committerKarl Williamson <khw@cpan.org>2020-12-07 21:52:14 -0700
commitb15e443511c11c1f196c5a5ca57b89feed452a07 (patch)
tree3262d96bfd4a602ae8779ecd7bde26e409dbf2f2 /toke.c
parent8ea1bb76772cbd78b5a9256d3b8507848e7bb2ec (diff)
downloadperl-b15e443511c11c1f196c5a5ca57b89feed452a07.tar.gz
toke.c: Eliminate temporary variables base, Base and max.
These variables are only used on emitting diagnostic messages. Calculating them on-demand will make the code slightly faster on normal cases. Note: previously bases[], Bases[] and maxima[] may be completely optimized out by fusing array accesses into if-brances. Now they become real arrays, and will slightly increase the number of dynamic relocations on PIC build.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/toke.c b/toke.c
index 37dcbbc939..9d9495f2c8 100644
--- a/toke.c
+++ b/toke.c
@@ -11460,7 +11460,6 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
"",
"037777777777",
"0xffffffff" };
- const char *base, *Base, *max;
/* check for hex */
if (isALPHA_FOLD_EQ(s[1], 'x')) {
@@ -11491,10 +11490,6 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
lastub = s++;
}
- base = bases[shift];
- Base = Bases[shift];
- max = new_octal ? "0o37777777777" : maxima[shift];
-
/* read the rest of the number */
for (;;) {
/* x is used in the overflow test,
@@ -11558,7 +11553,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
n = (NV) u;
Perl_ck_warner_d(aTHX_ packWARN(WARN_OVERFLOW),
"Integer overflow in %s number",
- base);
+ bases[shift]);
} else
u = x | b; /* add the digit to the end */
}
@@ -11772,7 +11767,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
if (*d) ++d; /* so the user sees the bad non-digit */
PL_bufptr = (char *)d; /* so yyerror reports the context */
yyerror(Perl_form(aTHX_ "No digits found for %s literal",
- base));
+ bases[shift]));
PL_bufptr = oldbp;
}
@@ -11780,7 +11775,8 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
if (n > 4294967295.0)
Perl_ck_warner(aTHX_ packWARN(WARN_PORTABLE),
"%s number > %s non-portable",
- Base, max);
+ Bases[shift],
+ new_octal ? "0o37777777777" : maxima[shift]);
sv = newSVnv(n);
}
else {
@@ -11788,7 +11784,8 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
if (u > 0xffffffff)
Perl_ck_warner(aTHX_ packWARN(WARN_PORTABLE),
"%s number > %s non-portable",
- Base, max);
+ Bases[shift],
+ new_octal ? "0o37777777777" : maxima[shift]);
#endif
sv = newSVuv(u);
}