summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-06-29 09:07:57 -0600
committerKarl Williamson <khw@cpan.org>2022-06-13 06:05:09 -0600
commit51c4bdf3527d2e4039f6f55f62a1ada0fd173ebf (patch)
tree393c9233cb601fba55d2942d7655d1e0b6f40dd8 /sv.h
parentfa50d782e52f23c55bcc3888e30de3b7cc01e3b4 (diff)
downloadperl-51c4bdf3527d2e4039f6f55f62a1ada0fd173ebf.tar.gz
Evaluate SvIV_please() param just once
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sv.h b/sv.h
index 0d940a80c8..2dab650a5c 100644
--- a/sv.h
+++ b/sv.h
@@ -1420,8 +1420,11 @@ object type. Exposed to perl code via Internals::SvREADONLY().
Not guaranteed to stay returning void */
/* Macro won't actually call sv_2iv if already IOK */
#define SvIV_please(sv) \
- STMT_START {if (!SvIOKp(sv) && (SvFLAGS(sv) & (SVf_NOK|SVf_POK))) \
- (void) SvIV(sv); } STMT_END
+ STMT_START { \
+ SV * sv_ = MUTABLE_SV(sv); \
+ if (!SvIOKp(sv_) && (SvFLAGS(sv_) & (SVf_NOK|SVf_POK))) \
+ (void) SvIV(sv_); \
+ } STMT_END
#define SvIV_please_nomg(sv) \
(!(SvFLAGS(sv) & (SVf_IOK|SVp_IOK)) && (SvFLAGS(sv) & (SVf_NOK|SVf_POK)) \
? (sv_2iv_flags(sv, 0), SvIOK(sv)) \