summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-09-03 08:21:35 +0000
committerNicholas Clark <nick@ccl4.org>2021-09-03 10:37:55 +0000
commitec7598c64132341ffec3934a78bad178846da36b (patch)
tree8b104c726fdd180a1dd9d5351d6ee58af4c61301 /sv.c
parent8937088f79a80f8cf6f85872e72e9a3b8325e19a (diff)
downloadperl-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 286abc545e..8d66500923 100644
--- a/sv.c
+++ b/sv.c
@@ -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;