From c1bee3910fc96b0524cf78054c1bb35d8b5a322a Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 29 Jun 2020 09:16:00 -0600 Subject: Evaluate SvSetSV_(nosteal_)?and() params just once --- sv.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'sv.h') diff --git a/sv.h b/sv.h index 2dab650a5c..129111b537 100644 --- a/sv.h +++ b/sv.h @@ -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 -- cgit v1.2.1