[master] cccb8c1d4 Flexelint d5bbb1a92322232591f48cc491dc7d266cdcfa11

Nils Goroll nils.goroll at uplex.de
Wed Jan 20 15:05:08 UTC 2021


commit cccb8c1d44daff940e89649be5f69d7b8797ad85
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Jan 20 16:03:45 2021 +0100

    Flexelint d5bbb1a92322232591f48cc491dc7d266cdcfa11
    
    We do not need to call trunc() to truncate a double into an integert.
    
    Mark the intention for flexelint with a cast.

diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c
index b214a38da..d6a30d0bb 100644
--- a/lib/libvarnishapi/vsl_query.c
+++ b/lib/libvarnishapi/vsl_query.c
@@ -217,7 +217,7 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
 				if (q != NULL)
 					t = (q > p) ? q - 1 : q;
 				p = TRUST_ME(t);
-				lhs_int = trunc(lhs_float);
+				lhs_int = (long long)lhs_float;
 			}
 			if (*p != '\0' && !isspace(*p))
 				return (0); /* Can't parse - no match */


More information about the varnish-commit mailing list