diff options
author | Sam Tregar <sam@tregar.com> | 2001-12-30 19:50:30 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-31 04:59:53 +0000 |
commit | d731386ac2ca77cd1b2028551263c37a4ebe0903 (patch) | |
tree | c94767be294d0181308d1d92591c7a02336fd751 /toke.c | |
parent | 86761af6df5a6fd2895b68fe934f1d2b3d92df3e (diff) | |
download | perl-d731386ac2ca77cd1b2028551263c37a4ebe0903.tar.gz |
Re: [PATCH] Basic bad prototype detection
Message-ID: <Pine.LNX.4.33.0112310017090.9102-200000@localhost.localdomain>
p4raw-id: //depot/perl@13974
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -4904,7 +4904,7 @@ Perl_yylex(pTHX) char tmpbuf[sizeof PL_tokenbuf]; SSize_t tboffset = 0; expectation attrful; - bool have_name, have_proto; + bool have_name, have_proto, bad_proto; int key = tmp; s = skipspace(s); @@ -4955,14 +4955,17 @@ Perl_yylex(pTHX) /* strip spaces and check for bad characters */ d = SvPVX(PL_lex_stuff); tmp = 0; + bad_proto = FALSE; for (p = d; *p; ++p) { - if (!strchr("$@%*;[]&\\ ", *p)) - Perl_croak(aTHX_ "Malformed prototype for %s : %s", - SvPVX(PL_subname), d); + if (!strchr("$@%*;[]&\\ ", *p)) + bad_proto = TRUE; if (!isSPACE(*p)) d[tmp++] = *p; } d[tmp] = '\0'; + if (bad_proto) + Perl_croak(aTHX_ "Malformed prototype for %s : %s", + SvPVX(PL_subname), d); SvCUR(PL_lex_stuff) = tmp; have_proto = TRUE; |