diff --git a/glib/ghash.c b/glib/ghash.c index 40a0fb2ca8b77834fbe7320ee5ee245404a4d2c5..f3ed0f3b913d7345fd3042e853f5d3be43c54483 100644 --- a/glib/ghash.c +++ b/glib/ghash.c @@ -565,13 +565,12 @@ g_hash_table_remove_node (GHashTable *hash_table, static void g_hash_table_setup_storage (GHashTable *hash_table) { - gboolean small; + gboolean small = FALSE; /* We want to use small arrays only if: * - we are running on a system where that makes sense (64 bit); and * - we are not running under valgrind. */ - small = FALSE; #ifdef USE_SMALL_ARRAYS small = TRUE; diff --git a/glib/tests/keyfile.c b/glib/tests/keyfile.c index ccbdadd56751c9212fcc322b275e231189a4ca25..7530bc8c32aea0a373fd3a1089e61fc0df8d22af 100644 --- a/glib/tests/keyfile.c +++ b/glib/tests/keyfile.c @@ -1151,6 +1151,7 @@ test_key_names (void) check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); + g_assert_null (value); g_key_file_free (keyfile); keyfile = g_key_file_new (); @@ -1160,6 +1161,7 @@ test_key_names (void) check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); + g_assert_null (value); g_key_file_free (keyfile); keyfile = g_key_file_new (); @@ -1177,6 +1179,7 @@ test_key_names (void) check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND); + g_assert_null (value); g_key_file_free (keyfile); keyfile = g_key_file_new (); diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c index 1368e9bc053ffce3f0ce9419653c0f01f1631657..ec96bfa8adc70494d11b7a71c50cdc4fc0aace26 100644 --- a/glib/tests/mainloop.c +++ b/glib/tests/mainloop.c @@ -121,6 +121,7 @@ test_maincontext_basic (void) g_source_set_funcs (source, &funcs); g_source_set_callback (source, cb, data, NULL); id = g_source_attach (source, ctx); + g_assert_cmpint (id, >, 0); g_source_unref (source); g_assert_true (g_source_remove_by_user_data (data)); g_assert_false (g_source_remove_by_user_data ((gpointer)0x1234)); diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c index e4302fd74a1b6106baa74bc2df8b300fe2c04ebf..a5ba2ea95c5e2b96c24e15df8eef8f0a8e8d7952 100644 --- a/glib/tests/mutex.c +++ b/glib/tests/mutex.c @@ -186,14 +186,16 @@ addition_thread (gpointer value) static void test_mutex_perf (gconstpointer data) { - gint n_threads = GPOINTER_TO_INT (data); + guint n_threads = GPOINTER_TO_UINT (data); GThread *threads[THREADS]; gint64 start_time; gdouble rate; gint x = -1; - gint i; + guint i; + + g_assert (n_threads <= G_N_ELEMENTS (threads)); - for (i = 0; i < n_threads - 1; i++) + for (i = 0; n_threads > 0 && i < n_threads - 1; i++) threads[i] = g_thread_create (addition_thread, &x, TRUE, NULL); /* avoid measuring thread setup/teardown time */ @@ -204,7 +206,7 @@ test_mutex_perf (gconstpointer data) rate = g_get_monotonic_time () - start_time; rate = x / rate; - for (i = 0; i < n_threads - 1; i++) + for (i = 0; n_threads > 0 && i < n_threads - 1; i++) g_thread_join (threads[i]); g_test_maximized_result (rate, "%f mips", rate); @@ -223,15 +225,15 @@ main (int argc, char *argv[]) if (g_test_perf ()) { - gint i; + guint i; - g_test_add_data_func ("/thread/mutex/perf/uncontended", NULL, test_mutex_perf); + g_test_add_data_func ("/thread/mutex/perf/uncontended", GUINT_TO_POINTER (0), test_mutex_perf); for (i = 1; i <= 10; i++) { gchar name[80]; - sprintf (name, "/thread/mutex/perf/contended/%d", i); - g_test_add_data_func (name, GINT_TO_POINTER (i), test_mutex_perf); + sprintf (name, "/thread/mutex/perf/contended/%u", i); + g_test_add_data_func (name, GUINT_TO_POINTER (i), test_mutex_perf); } } diff --git a/glib/tests/regex.c b/glib/tests/regex.c index ee9cd21cac08be8bd7876181288a5b61b625ff48..1ea6f9288a74d00e7deb62c59e4b17108e37b382 100644 --- a/glib/tests/regex.c +++ b/glib/tests/regex.c @@ -712,6 +712,7 @@ test_fetch_all (gconstpointer d) l_exp = data->expected; for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp)) { + g_assert_nonnull (matches); g_assert_cmpstr (l_exp->data, ==, matches[i]); } @@ -800,6 +801,7 @@ test_split_simple (gconstpointer d) l_exp = data->expected; for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp)) { + g_assert_nonnull (tokens); g_assert_cmpstr (l_exp->data, ==, tokens[i]); } @@ -883,6 +885,7 @@ test_split_full (gconstpointer d) l_exp = data->expected; for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp)) { + g_assert_nonnull (tokens); g_assert_cmpstr (l_exp->data, ==, tokens[i]); } @@ -915,6 +918,7 @@ test_split (gconstpointer d) l_exp = data->expected; for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp)) { + g_assert_nonnull (tokens); g_assert_cmpstr (l_exp->data, ==, tokens[i]); }