[master] 92bd45b8c vrt_var: Avoid repeated side effects in VRT_TMO()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Mar 5 09:33:05 UTC 2024
commit 92bd45b8c7348f3e18dedf606c7282dd43110aab
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Mar 5 10:30:46 2024 +0100
vrt_var: Avoid repeated side effects in VRT_TMO()
Warning 666: Expression with side effects passed to repeated
parameter 1 in macro 'VRT_TMO'
Spotted by Flexelint.
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index a7e018713..60409beca 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -402,10 +402,12 @@ VRT_l_bereq_##which(VRT_CTX, VCL_DURATION num) \
VCL_DURATION \
VRT_r_bereq_##which(VRT_CTX) \
{ \
+ vtim_dur res; \
\
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \
- return (VRT_TMO(BUSYOBJ_TMO(ctx->bo, prefix, which))); \
+ res = BUSYOBJ_TMO(ctx->bo, prefix, which); \
+ return (VRT_TMO(res)); \
} \
\
VCL_VOID \
@@ -1144,9 +1146,12 @@ VRT_l_sess_##x(VRT_CTX, VCL_DURATION d) \
VCL_DURATION \
VRT_r_sess_##x(VRT_CTX) \
{ \
+ vtim_dur res; \
+ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->sp, SESS_MAGIC); \
- return (VRT_TMO(SESS_TMO(ctx->sp, x))); \
+ res = SESS_TMO(ctx->sp, x); \
+ return (VRT_TMO(res)); \
} \
\
VCL_VOID \
More information about the varnish-commit
mailing list