summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-21 16:15:32 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-22 13:31:22 -0800
commit94250aee408add483c1bb5d139839eb6510650b2 (patch)
tree9b9609969b53f0a0eb33755334982fdff16b526c /hv.c
parentb861b87ffee6ad459fd7a2e4ee74d162f6e7ca70 (diff)
downloadperl-94250aee408add483c1bb5d139839eb6510650b2.tar.gz
speed up feature-checking slightly
When seeing whether the cop hint hash contains the given feature, Perl_feature_is_enabled only needs to see whether the hint hash ele- ment exists. It doesn’t need to turn it into a scalar.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/hv.c b/hv.c
index 7d5843811e..1c5e6bc776 100644
--- a/hv.c
+++ b/hv.c
@@ -2995,7 +2995,7 @@ Perl_refcounted_he_fetch_pvn(pTHX_ const struct refcounted_he *chain,
U8 utf8_flag;
PERL_ARGS_ASSERT_REFCOUNTED_HE_FETCH_PVN;
- if (flags & ~REFCOUNTED_HE_KEY_UTF8)
+ if (flags & ~(REFCOUNTED_HE_KEY_UTF8|REFCOUNTED_HE_EXISTS))
Perl_croak(aTHX_ "panic: refcounted_he_fetch_pvn bad flags %"UVxf,
(UV)flags);
if (!chain)
@@ -3047,9 +3047,15 @@ Perl_refcounted_he_fetch_pvn(pTHX_ const struct refcounted_he *chain,
utf8_flag == (HEK_FLAGS(chain->refcounted_he_hek) & HVhek_UTF8)
#endif
)
- return sv_2mortal(refcounted_he_value(chain));
- }
- return &PL_sv_placeholder;
+ return
+ flags & REFCOUNTED_HE_EXISTS
+ ? (chain->refcounted_he_data[0] & HVrhek_typemask)
+ == HVrhek_delete
+ ? NULL
+ : &PL_sv_yes
+ : sv_2mortal(refcounted_he_value(chain));
+ }
+ return flags & REFCOUNTED_HE_EXISTS ? NULL : &PL_sv_placeholder;
}
/*