diff options
author | Karl Williamson <khw@cpan.org> | 2020-06-29 09:16:00 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-06-13 06:05:09 -0600 |
commit | c1bee3910fc96b0524cf78054c1bb35d8b5a322a (patch) | |
tree | 5f3668fc011f830cee8894640352d50f3ecb8d21 /sv.h | |
parent | 51c4bdf3527d2e4039f6f55f62a1ada0fd173ebf (diff) | |
download | perl-c1bee3910fc96b0524cf78054c1bb35d8b5a322a.tar.gz |
Evaluate SvSetSV_(nosteal_)?and() params just once
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -2298,15 +2298,23 @@ properly null terminated. Equivalent to sv_setpvs(""), but more efficient. #define SvSetSV_and(dst,src,finally) \ STMT_START { \ - if (LIKELY((dst) != (src))) { \ - sv_setsv(dst, src); \ + SV * src_ = src; \ + SV * dst_ = dst; \ + if (LIKELY((dst_) != (src_))) { \ + sv_setsv(dst_, src_); \ finally; \ } \ } STMT_END + #define SvSetSV_nosteal_and(dst,src,finally) \ STMT_START { \ - if (LIKELY((dst) != (src))) { \ - sv_setsv_flags(dst, src, SV_GMAGIC | SV_NOSTEAL | SV_DO_COW_SVSETSV); \ + SV * src_ = src; \ + SV * dst_ = dst; \ + if (LIKELY((dst_) != (src_))) { \ + sv_setsv_flags(dst_, src_, \ + SV_GMAGIC \ + | SV_NOSTEAL \ + | SV_DO_COW_SVSETSV); \ finally; \ } \ } STMT_END |