summaryrefslogtreecommitdiff
path: root/mro_core.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2022-11-17 14:30:39 +1100
committerJames E Keenan <jkeenan@cpan.org>2022-11-18 18:12:45 -0500
commit2e4090b82403991910f1fe64866048b62ccf5402 (patch)
tree8ca250b0bfb4e386128336ee73db71caba26c032 /mro_core.c
parenta33534361e54c6342c59edd0c06b6bbb9ac5776c (diff)
downloadperl-2e4090b82403991910f1fe64866048b62ccf5402.tar.gz
only fully calculate the stash (effective) name where needed
gcc 12 was complaining that evaluating (somehekptr)->hek_key was always true in many places where HvNAME() or HvENAME() was being called in boolean context. Add new macros to check whether the names should be available and use those instead.
Diffstat (limited to 'mro_core.c')
-rw-r--r--mro_core.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mro_core.c b/mro_core.c
index 09fbc27ab4..2be181e102 100644
--- a/mro_core.c
+++ b/mro_core.c
@@ -425,8 +425,8 @@ Perl_mro_get_linear_isa(pTHX_ HV *stash)
if (meta->mro_which != &dfs_alg) { /* skip for dfs, for speed */
SV * const namesv =
- (HvENAME(stash)||HvNAME(stash))
- ? newSVhek(HvENAME_HEK(stash)
+ (HvHasENAME_HEK(stash) || HvHasNAME(stash))
+ ? newSVhek(HvHasENAME_HEK(stash)
? HvENAME_HEK(stash)
: HvNAME_HEK(stash))
: NULL;
@@ -787,7 +787,7 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash,
if(!(flags & 1)) {
SV **svp;
if(
- !GvSTASH(gv) || !HvENAME(GvSTASH(gv)) ||
+ !GvSTASH(gv) || !HvHasENAME(GvSTASH(gv)) ||
!(svp = hv_fetchhek(GvSTASH(gv), GvNAME_HEK(gv), 0)) ||
*svp != (SV *)gv
) return;
@@ -903,7 +903,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
HE *entry;
I32 riter = -1;
I32 items = 0;
- const bool stash_had_name = stash && HvENAME(stash);
+ const bool stash_had_name = stash && HvHasENAME(stash);
bool fetched_isarev = FALSE;
HV *seen = NULL;
HV *isarev = NULL;
@@ -1163,7 +1163,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
stashentry && *stashentry && isGV(*stashentry)
&& (substash = GvHV(*stashentry))
)
- || (oldsubstash && HvENAME_get(oldsubstash))
+ || (oldsubstash && HvHasENAME(oldsubstash))
)
{
/* Add :: and the key (minus the trailing ::)