Skip to content

Commit c3ebe61

Browse files
committed
toke.c: Change S_scan_ident parameter
Change it from being an array length, to being a pointer to the ending position of the array. This makes this function consistent with most of the others in this file. It allows us to usually use C_ARRAY_END() to wrap the parameter, which simplifies some expressions,
1 parent 9f0a1b6 commit c3ebe61

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6110,7 +6110,7 @@ RS |char * |scan_formline |NN char *s
61106110
RS |char * |scan_heredoc |NN char *s
61116111
S |char * |scan_ident |NN char *s \
61126112
|NN char *dest \
6113-
|STRLEN destlen \
6113+
|NN char *dest_end \
61146114
|I32 ck_uni
61156115
RS |char * |scan_inputsymbol \
61166116
|NN char *start

proto.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

toke.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,7 +4617,7 @@ S_intuit_more(pTHX_ char *s, char *e)
46174617
if (isWORDCHAR_lazy_if_safe(s+1, PL_bufend, UTF)) {
46184618
int len;
46194619
char tmpbuf[sizeof PL_tokenbuf * 4];
4620-
scan_ident(s, tmpbuf, sizeof tmpbuf, FALSE);
4620+
scan_ident(s, tmpbuf, C_ARRAY_END(tmpbuf), FALSE);
46214621
len = (int)strlen(tmpbuf);
46224622
if ( len > 1
46234623
&& gv_fetchpvn_flags(tmpbuf,
@@ -5364,8 +5364,8 @@ yyl_dollar(pTHX_ char *s)
53645364
|| memCHRs("{$:+-@", s[2])))
53655365
{
53665366
PL_tokenbuf[0] = '@';
5367-
s = scan_ident(s + 1, PL_tokenbuf + 1,
5368-
sizeof PL_tokenbuf - 1, FALSE);
5367+
s = scan_ident(s + 1, PL_tokenbuf + 1, C_ARRAY_END(PL_tokenbuf),
5368+
FALSE);
53695369
S_warn_expect_operator(aTHX_ "Array length", s, POP_OLDBUFPTR);
53705370
if (!PL_tokenbuf[1])
53715371
PREREF(DOLSHARP);
@@ -5375,7 +5375,7 @@ yyl_dollar(pTHX_ char *s)
53755375
}
53765376

53775377
PL_tokenbuf[0] = '$';
5378-
s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE);
5378+
s = scan_ident(s, PL_tokenbuf + 1, C_ARRAY_END(PL_tokenbuf), FALSE);
53795379
S_warn_expect_operator(aTHX_ "Scalar", s, POP_OLDBUFPTR);
53805380
if (!PL_tokenbuf[1]) {
53815381
if (s == PL_bufend)
@@ -6038,7 +6038,7 @@ yyl_star(pTHX_ char *s)
60386038
POSTDEREF(PERLY_STAR);
60396039

60406040
if (PL_expect != XOPERATOR) {
6041-
s = scan_ident(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE);
6041+
s = scan_ident(s, PL_tokenbuf, C_ARRAY_END(PL_tokenbuf), TRUE);
60426042
PL_expect = XOPERATOR;
60436043
force_ident(PL_tokenbuf, PERLY_STAR);
60446044
if (!*PL_tokenbuf)
@@ -6086,7 +6086,7 @@ yyl_percent(pTHX_ char *s)
60866086
POSTDEREF(PERLY_PERCENT_SIGN);
60876087

60886088
PL_tokenbuf[0] = '%';
6089-
s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE);
6089+
s = scan_ident(s, PL_tokenbuf + 1, C_ARRAY_END(PL_tokenbuf), FALSE);
60906090
pl_yylval.ival = 0;
60916091
if (!PL_tokenbuf[1]) {
60926092
PREREF(PERLY_PERCENT_SIGN);
@@ -6623,7 +6623,7 @@ yyl_ampersand(pTHX_ char *s)
66236623
}
66246624

66256625
PL_tokenbuf[0] = '&';
6626-
s = scan_ident(s - 1, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, TRUE);
6626+
s = scan_ident(s - 1, PL_tokenbuf + 1, C_ARRAY_END(PL_tokenbuf), TRUE);
66276627
pl_yylval.ival = (OPpENTERSUB_AMPER<<8);
66286628

66296629
if (PL_tokenbuf[1])
@@ -6708,7 +6708,7 @@ yyl_snail(pTHX_ char *s)
67086708
if (PL_expect == XPOSTDEREF)
67096709
POSTDEREF(PERLY_SNAIL);
67106710
PL_tokenbuf[0] = '@';
6711-
s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE);
6711+
s = scan_ident(s, PL_tokenbuf + 1, C_ARRAY_END(PL_tokenbuf), FALSE);
67126712
S_warn_expect_operator(aTHX_ "Array", s, POP_OLDBUFPTR);
67136713
pl_yylval.ival = 0;
67146714
if (!PL_tokenbuf[1]) {
@@ -10376,13 +10376,13 @@ Perl_scan_word(pTHX_ char *s, char *dest, char * dest_end, int allow_package, ST
1037610376
* specific variable name.
1037710377
*/
1037810378
STATIC char *
10379-
S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
10379+
S_scan_ident(pTHX_ char *s, char *dest, char *dest_end, I32 ck_uni)
1038010380
{
1038110381
I32 herelines = PL_parser->herelines;
1038210382
SSize_t bracket = -1;
1038310383
char funny = *s++;
1038410384
char *d = dest;
10385-
char * const e = d + destlen - 3; /* two-character token, ending NUL */
10385+
char * const e = dest_end - 3; /* two-character token, ending NUL */
1038610386
bool is_utf8 = cBOOL(UTF);
1038710387
line_t orig_copline = 0, tmp_copline = 0;
1038810388

0 commit comments

Comments
 (0)