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>
This commit is contained in:
Philip Withnall 2022-06-07 11:09:39 +01:00
parent 504727c317
commit 6c0bde8aa4

View File

@ -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;