From 31664e62f93f715dd868097524cad8834961369f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 27 Feb 2019 11:54:42 +0000 Subject: [PATCH] tests: Remove unnecessary static attributes from variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions are not run more than once, so the variables don’t need to be static to save state between runs. Signed-off-by: Philip Withnall --- gobject/tests/closure-refcount.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gobject/tests/closure-refcount.c b/gobject/tests/closure-refcount.c index 941db9b0f..184860b6b 100644 --- a/gobject/tests/closure-refcount.c +++ b/gobject/tests/closure-refcount.c @@ -176,11 +176,12 @@ static gpointer thread1_main (gpointer data) { GClosure *closure = data; - while (!stopping) + guint i = 0; + + for (i = 0; !stopping; i++) { - static guint count = 0; test_closure (closure); - if (++count % 10000 == 0) + if (i % 10000 == 0) { g_test_message ("Yielding from thread1"); g_thread_yield(); /* force context switch */ @@ -194,11 +195,12 @@ static gpointer thread2_main (gpointer data) { GClosure *closure = data; - while (!stopping) + guint i = 0; + + for (i = 0; !stopping; i++) { - static guint count = 0; test_closure (closure); - if (++count % 10000 == 0) + if (i % 10000 == 0) { g_test_message ("Yielding from thread2"); g_thread_yield(); /* force context switch */ @@ -272,9 +274,8 @@ test_closure_refcount (void) for (i = 0; i < 1000000; i++) #endif { - static guint count = 0; test_emissions (object); - if (++count % 10000 == 0) + if (i % 10000 == 0) { g_test_message ("Yielding from main thread"); g_thread_yield(); /* force context switch */