This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
constant.pm: Remove redundant truth checks
authorFather Chrysostomos <sprout@cpan.org>
Tue, 26 Aug 2014 04:45:50 +0000 (21:45 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 26 Aug 2014 05:17:03 +0000 (22:17 -0700)
It is not possible to reach these without $symtab’s having been
assigned a stash reference.

dist/constant/lib/constant.pm

index a838d7e..d1b32c5 100644 (file)
@@ -162,7 +162,7 @@ sub import {
                    # The check in Perl_ck_rvconst knows that inlinable
                    # constants from cv_const_sv are read only. So we have to:
                    Internals::SvREADONLY($scalar, 1);
-                   if ($symtab && !exists $symtab->{$name}) {
+                   if (!exists $symtab->{$name}) {
                        $symtab->{$name} = \$scalar;
                        ++$flush_mro->{$pkg};
                    }
@@ -178,7 +178,7 @@ sub import {
                if (_CAN_PCS_FOR_ARRAY) {
                    _make_const($list[$_]) for 0..$#list;
                    _make_const(@list);
-                   if ($symtab && !exists $symtab->{$name}) {
+                   if (!exists $symtab->{$name}) {
                        $symtab->{$name} = \@list;
                        $flush_mro->{$pkg}++;
                    }