diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-09-03 08:21:35 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-09-03 10:37:55 +0000 |
commit | ec7598c64132341ffec3934a78bad178846da36b (patch) | |
tree | 8b104c726fdd180a1dd9d5351d6ee58af4c61301 /sv.c | |
parent | 8937088f79a80f8cf6f85872e72e9a3b8325e19a (diff) | |
download | perl-ec7598c64132341ffec3934a78bad178846da36b.tar.gz |
Use HvTOTALKEYS() in place of HvARRAY() in various boolean tests
This is a better choice for an "is it empty?" optimisation, as HvARRAY()
can be non-NULL even when there actually are no keys.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9905,7 +9905,7 @@ Perl_sv_resetpvn(pTHX_ const char *s, STRLEN len, HV * const stash) /* reset variables */ - if (!HvARRAY(stash)) + if (!HvTOTALKEYS(stash)) return; Zero(todo, 256, char); @@ -16235,7 +16235,7 @@ S_find_hash_subscript(pTHX_ const HV *const hv, const SV *const val) PERL_ARGS_ASSERT_FIND_HASH_SUBSCRIPT; - if (!hv || SvMAGICAL(hv) || !HvARRAY(hv) || + if (!hv || SvMAGICAL(hv) || !HvTOTALKEYS(hv) || (HvTOTALKEYS(hv) > FUV_MAX_SEARCH_SIZE)) return NULL; |