]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/DEBUG: lru: fix printf format in debug code
authorWilly Tarreau <w@1wt.eu>
Tue, 12 Apr 2022 06:16:54 +0000 (08:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 12 Apr 2022 06:19:33 +0000 (08:19 +0200)
cppcheck reports in issue #1184 a type mismatch between "%d" and the
unsigned int "misses" in the standalone debug code of lru.c. Let's
switch to "%u".

src/lru.c

index f092588e3deb59f8c5c4dccf7e33c74b0fb24d14..07ef50c431b4ca9b4e56e5f5383a4cd638e597b7 100644 (file)
--- a/src/lru.c
+++ b/src/lru.c
@@ -295,7 +295,7 @@ int main(int argc, char **argv)
                ret += get_value(lru, statistical_prng() & 65535);
        }
        /* just for accuracy control */
-       printf("ret=%llx, hits=%d, misses=%d (%d %% hits)\n", ret, total-misses, misses, (int)((float)(total-misses) * 100.0 / total));
+       printf("ret=%llx, hits=%u, misses=%u (%d %% hits)\n", ret, (unsigned)(total-misses), misses, (int)((float)(total-misses) * 100.0 / total));
 
        while (lru64_destroy(lru));