From 99267034941e1f6e8c39ee19c570404fcec121ce Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 7 Jun 2022 11:11:04 +0100 Subject: [PATCH] tests: Avoid an uninitialised variable warning in slice-memchunk test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dynamically, all the right elements of `ps` are initialised before they are used. However, scan-build doesn’t think so. It (probably) thinks that `number_of_blocks` could change value between the different loops over `ps`. Try and avoid that by marking `number_of_blocks` (and related variables) as `const`. Signed-off-by: Philip Withnall --- glib/tests/slice-memchunk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glib/tests/slice-memchunk.c b/glib/tests/slice-memchunk.c index 0938eb96f..ea8bee0c0 100644 --- a/glib/tests/slice-memchunk.c +++ b/glib/tests/slice-memchunk.c @@ -25,11 +25,11 @@ #define quick_rand32() \ (rand_accu = 1664525 * rand_accu + 1013904223, rand_accu) -static guint prime_size = 1021; /* 769; 509 */ -static gboolean clean_memchunks = FALSE; -static guint number_of_blocks = 10000; /* total number of blocks allocated */ -static guint number_of_repetitions = 10000; /* number of alloc+free repetitions */ -static gboolean want_corruption = FALSE; +static const guint prime_size = 1021; /* 769; 509 */ +static const gboolean clean_memchunks = FALSE; +static const guint number_of_blocks = 10000; /* total number of blocks allocated */ +static const guint number_of_repetitions = 10000; /* number of alloc+free repetitions */ +static const gboolean want_corruption = FALSE; /* --- old memchunk prototypes (memchunks.c) --- */ GMemChunk* old_mem_chunk_new (const gchar *name,