[glib: 5/6] tests: Avoid an uninitialised variable warning in slice-memchunk test




commit 99267034941e1f6e8c39ee19c570404fcec121ce
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jun 7 11:11:04 2022 +0100

    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>

 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 0938eb96f8..ea8bee0c06 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]