From 808a981e86fb3b142237e7c007e4b39175ae9e30 Mon Sep 17 00:00:00 2001 From: Stu Tomlinson Date: Wed, 2 Mar 2022 11:25:44 +0000 Subject: [PATCH] Compile fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit examples/perf.c: In function ‘perf_rand’: examples/perf.c:42:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (size_t sz = 2; sz <= alloc_sz; sz <<= 1) { --- examples/perf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/perf.c b/examples/perf.c index c4c9ff8..f6b719f 100644 --- a/examples/perf.c +++ b/examples/perf.c @@ -32,6 +32,7 @@ static void perf_rand(xmpp_ctx_t *ctx) uint64_t t1, t2; unsigned int n; const size_t alloc_sz = 0x1000u; + size_t sz; unsigned char *buf = malloc(alloc_sz); /* pre-heat */ @@ -39,7 +40,7 @@ static void perf_rand(xmpp_ctx_t *ctx) xmpp_rand_bytes(rng, buf, n * 10); } - for (size_t sz = 2; sz <= alloc_sz; sz <<= 1) { + for (sz = 2; sz <= alloc_sz; sz <<= 1) { t2 = 0; for (n = 0; n < 1000u; ++n) {