[glib: 4/6] tests: Fix a scan-build warning about uninitialised threads
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 4/6] tests: Fix a scan-build warning about uninitialised threads
- Date: Tue, 7 Jun 2022 10:50:18 +0000 (UTC)
commit 6c0bde8aa4c0b4471d117d50f2afca1db5836f1f
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Jun 7 11:09:39 2022 +0100
tests: Fix a scan-build warning about uninitialised threads
It seems that scan-build assumes `n_threads > 0`, but doesn’t assume a
tighter condition than that, and hence assumes that the two loops to
initialise and join the threads have different numbers of iterations.
That’s obviously not the case.
Try and help scan-build out here by marking `n_threads` as `const`. I
don’t know if this will work, but it’s correct regardless.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
glib/tests/mutex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c
index a5ba2ea95c..120229e42d 100644
--- a/glib/tests/mutex.c
+++ b/glib/tests/mutex.c
@@ -186,7 +186,7 @@ addition_thread (gpointer value)
static void
test_mutex_perf (gconstpointer data)
{
- guint n_threads = GPOINTER_TO_UINT (data);
+ const guint n_threads = GPOINTER_TO_UINT (data);
GThread *threads[THREADS];
gint64 start_time;
gdouble rate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]