diff options
author | Yves Orton <demerphq@gmail.com> | 2023-03-22 09:51:39 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-03-29 20:54:49 +0800 |
commit | cb6188df375141f4ec9f33cc918fd640b1ff81b6 (patch) | |
tree | 7732e6b532d54448fee99f99d215af8aea6874e6 /sv.c | |
parent | fe67e58303186e966b34e7dbff135b02fbef325e (diff) | |
download | perl-cb6188df375141f4ec9f33cc918fd640b1ff81b6.tar.gz |
sv.c - don't cast SVTYPEMASK to svtype, use SvIS_FREED() instead.
svtype is an enum with 18 values. SVTYPEMASK is 31. A picky compiler
(like on HPUX) will complain that casting 31 to a svtype is an error.
We have SvIS_FREED() to do this properly anyway.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -387,7 +387,7 @@ S_visit(pTHX_ SVFUNC_t f, const U32 flags, const U32 mask) const SV * const svend = &sva[SvREFCNT(sva)]; SV* sv; for (sv = sva + 1; sv < svend; ++sv) { - if (SvTYPE(sv) != (svtype)SVTYPEMASK + if (!SvIS_FREED(sv) && (sv->sv_flags & mask) == flags && SvREFCNT(sv)) { @@ -406,7 +406,7 @@ S_visit(pTHX_ SVFUNC_t f, const U32 flags, const U32 mask) static void do_report_used(pTHX_ SV *const sv) { - if (SvTYPE(sv) != (svtype)SVTYPEMASK) { + if (!SvIS_FREED(sv)) { PerlIO_printf(Perl_debug_log, "****\n"); sv_dump(sv); } @@ -6626,7 +6626,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) HV *stash; assert(SvREFCNT(sv) == 0); - assert(SvTYPE(sv) != (svtype)SVTYPEMASK); + assert(!SvIS_FREED(sv)); #if NVSIZE <= IVSIZE if (type <= SVt_NV) { #else @@ -10035,7 +10035,7 @@ Perl_newSVsv_flags(pTHX_ SV *const old, I32 flags) if (!old) return NULL; - if (SvTYPE(old) == (svtype)SVTYPEMASK) { + if (SvIS_FREED(old)) { Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL), "semi-panic: attempt to dup freed string"); return NULL; } @@ -14516,7 +14516,7 @@ S_sv_dup_common(pTHX_ const SV *const ssv, CLONE_PARAMS *const param) PERL_ARGS_ASSERT_SV_DUP_COMMON; - if (SvTYPE(ssv) == (svtype)SVTYPEMASK) { + if (SvIS_FREED(ssv)) { #ifdef DEBUG_LEAKING_SCALARS_ABORT abort(); #endif |