In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/446b89af54d4dd848d5432e339a1456502eaee01?hp=a74ff37d56a36f313c3eec2c8f99167b0c7a28d9>
- Log ----------------------------------------------------------------- commit 446b89af54d4dd848d5432e339a1456502eaee01 Author: Jarkko Hietaniemi <[email protected]> Date: Mon Jul 28 22:10:47 2014 -0400 Mention sv_gets as the Perl-ish fgets-ish API. M t/porting/libperl.t commit 26065e6c9b1e28a59935bef1cddb98278a829253 Author: Jarkko Hietaniemi <[email protected]> Date: Mon Jul 28 22:36:44 2014 -0400 Add atol, atoll, strtoq to avoidables. M t/porting/libperl.t commit 6c1246d3c25b15456c85cff0be0abc60bfb9c8f0 Author: Jarkko Hietaniemi <[email protected]> Date: Mon Jul 28 22:09:34 2014 -0400 Add system to avoidables. M pod/perlclib.pod M t/porting/libperl.t commit e05c5d0845ee6e5d8fe7218314dde23c083265cc Author: Jarkko Hietaniemi <[email protected]> Date: Mon Jul 28 22:06:08 2014 -0400 grok_atou() is UV now, not Size_t. M pod/perlclib.pod commit e1ee396065926b895c7d618e39afbf16cb549f31 Author: Jarkko Hietaniemi <[email protected]> Date: Tue Jul 29 07:54:57 2014 -0400 Move return false out of switch default. M regexec.c ----------------------------------------------------------------------- Summary of changes: pod/perlclib.pod | 5 ++--- regexec.c | 10 ++-------- t/porting/libperl.t | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pod/perlclib.pod b/pod/perlclib.pod index b4ebe4e..7f86f1b 100644 --- a/pod/perlclib.pod +++ b/pod/perlclib.pod @@ -209,8 +209,7 @@ C<toUPPER_uni>, as described in L<perlapi/Character case changing>.) Notice also the C<grok_bin>, C<grok_hex>, and C<grok_oct> functions in F<numeric.c> for converting strings representing numbers in the respective bases into C<NV>s. Note that grok_atou() doesn't handle negative inputs, -or leading whitespace (being purposefully strict). It also doesn't always -handle full IV/UV-range, being limited to Size_t. +or leading whitespace (being purposefully strict). Note that strtol() and strtoul() may be disguised as Strtol(), Strtoul(), Atol(), Atoul(). Avoid those, too. @@ -225,7 +224,7 @@ everywhere by now. PL_srand_called = TRUE; } exit(n) my_exit(n) - system(s) Don't. Look at pp_system or use my_popen + system(s) Don't. Look at pp_system or use my_popen. getenv(s) PerlEnv_getenv(s) setenv(s, val) my_putenv(s, val) diff --git a/regexec.c b/regexec.c index 432764b..33fb5da 100644 --- a/regexec.c +++ b/regexec.c @@ -536,16 +536,10 @@ S_isFOO_utf8_lc(pTHX_ const U8 classnum, const U8* character) case _CC_ENUM_BLANK: return is_HORIZWS_high(character); case _CC_ENUM_XDIGIT: return is_XDIGIT_high(character); case _CC_ENUM_VERTSPACE: return is_VERTWS_high(character); - default: return 0; /* Things like CNTRL are always - below 256 */ + default: break; } - /* NOTREACHED */ - /* Some compilers/linters detect that this spot cannot be reached - * (because all code paths above already did return), while some - * others throw a fit unless we have a return at the end. */ - assert(0); - return FALSE; + return FALSE; /* Things like CNTRL are always below 256 */ } /* diff --git a/t/porting/libperl.t b/t/porting/libperl.t index 9562556..f62b80d 100644 --- a/t/porting/libperl.t +++ b/t/porting/libperl.t @@ -468,10 +468,11 @@ for my $symbol (sort keys %expected) { } # There are certain symbols we expect NOT to see. - +# # gets is horribly unsafe. # -# fgets should not be used (Perl has its own API), even without perlio. +# fgets should not be used (Perl has its own API, sv_gets), +# even without perlio. # # tmpfile is unsafe. # @@ -483,12 +484,20 @@ for my $symbol (sort keys %expected) { # the native sprintf is still used in some platforms, see below.) # # atoi has unsafe and undefined failure modes, and is affected by locale. +# Its cousins include atol and atoll. # # strtol and strtoul are affected by locale. +# Cousins include strtoq. +# +# system should not be used, use pp_system or my_popen. # my %unexpected; +for my $str (qw(system)) { + $unexpected{$str} = "d_$str"; +} + for my $stdio (qw(gets fgets tmpfile sprintf vsprintf)) { $unexpected{$stdio} = undef; # No Configure symbol for these. } @@ -497,8 +506,9 @@ for my $str (qw(strcat strcpy strncat strncpy)) { } $unexpected{atoi} = undef; # No Configure symbol for atoi. +$unexpected{atol} = undef; # No Configure symbol for atol. -for my $str (qw(strtol strtoul)) { +for my $str (qw(atoll strtol strtoul strtoq)) { $unexpected{$str} = "d_$str"; } -- Perl5 Master Repository
