tests: Avoid an uninitialised variable warning in slice-memchunk test

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 <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-06-07 11:11:04 +01:00
parent 6c0bde8aa4
commit 9926703494

View File

@ -25,11 +25,11 @@
#define quick_rand32() \ #define quick_rand32() \
(rand_accu = 1664525 * rand_accu + 1013904223, rand_accu) (rand_accu = 1664525 * rand_accu + 1013904223, rand_accu)
static guint prime_size = 1021; /* 769; 509 */ static const guint prime_size = 1021; /* 769; 509 */
static gboolean clean_memchunks = FALSE; static const gboolean clean_memchunks = FALSE;
static guint number_of_blocks = 10000; /* total number of blocks allocated */ static const guint number_of_blocks = 10000; /* total number of blocks allocated */
static guint number_of_repetitions = 10000; /* number of alloc+free repetitions */ static const guint number_of_repetitions = 10000; /* number of alloc+free repetitions */
static gboolean want_corruption = FALSE; static const gboolean want_corruption = FALSE;
/* --- old memchunk prototypes (memchunks.c) --- */ /* --- old memchunk prototypes (memchunks.c) --- */
GMemChunk* old_mem_chunk_new (const gchar *name, GMemChunk* old_mem_chunk_new (const gchar *name,