mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-02 02:40:07 +02:00
Merge branch 'scan-build-warnings' into 'master'
Fix various minor scan build warnings See merge request GNOME/glib!1696
This commit is contained in:
commit
7b73546ae5
@ -565,13 +565,12 @@ g_hash_table_remove_node (GHashTable *hash_table,
|
|||||||
static void
|
static void
|
||||||
g_hash_table_setup_storage (GHashTable *hash_table)
|
g_hash_table_setup_storage (GHashTable *hash_table)
|
||||||
{
|
{
|
||||||
gboolean small;
|
gboolean small = FALSE;
|
||||||
|
|
||||||
/* We want to use small arrays only if:
|
/* We want to use small arrays only if:
|
||||||
* - we are running on a system where that makes sense (64 bit); and
|
* - we are running on a system where that makes sense (64 bit); and
|
||||||
* - we are not running under valgrind.
|
* - we are not running under valgrind.
|
||||||
*/
|
*/
|
||||||
small = FALSE;
|
|
||||||
|
|
||||||
#ifdef USE_SMALL_ARRAYS
|
#ifdef USE_SMALL_ARRAYS
|
||||||
small = TRUE;
|
small = TRUE;
|
||||||
|
@ -1151,6 +1151,7 @@ test_key_names (void)
|
|||||||
check_error (&error,
|
check_error (&error,
|
||||||
G_KEY_FILE_ERROR,
|
G_KEY_FILE_ERROR,
|
||||||
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
|
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
|
||||||
|
g_assert_null (value);
|
||||||
g_key_file_free (keyfile);
|
g_key_file_free (keyfile);
|
||||||
|
|
||||||
keyfile = g_key_file_new ();
|
keyfile = g_key_file_new ();
|
||||||
@ -1160,6 +1161,7 @@ test_key_names (void)
|
|||||||
check_error (&error,
|
check_error (&error,
|
||||||
G_KEY_FILE_ERROR,
|
G_KEY_FILE_ERROR,
|
||||||
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
|
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
|
||||||
|
g_assert_null (value);
|
||||||
g_key_file_free (keyfile);
|
g_key_file_free (keyfile);
|
||||||
|
|
||||||
keyfile = g_key_file_new ();
|
keyfile = g_key_file_new ();
|
||||||
@ -1177,6 +1179,7 @@ test_key_names (void)
|
|||||||
check_error (&error,
|
check_error (&error,
|
||||||
G_KEY_FILE_ERROR,
|
G_KEY_FILE_ERROR,
|
||||||
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
|
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
|
||||||
|
g_assert_null (value);
|
||||||
g_key_file_free (keyfile);
|
g_key_file_free (keyfile);
|
||||||
|
|
||||||
keyfile = g_key_file_new ();
|
keyfile = g_key_file_new ();
|
||||||
|
@ -121,6 +121,7 @@ test_maincontext_basic (void)
|
|||||||
g_source_set_funcs (source, &funcs);
|
g_source_set_funcs (source, &funcs);
|
||||||
g_source_set_callback (source, cb, data, NULL);
|
g_source_set_callback (source, cb, data, NULL);
|
||||||
id = g_source_attach (source, ctx);
|
id = g_source_attach (source, ctx);
|
||||||
|
g_assert_cmpint (id, >, 0);
|
||||||
g_source_unref (source);
|
g_source_unref (source);
|
||||||
g_assert_true (g_source_remove_by_user_data (data));
|
g_assert_true (g_source_remove_by_user_data (data));
|
||||||
g_assert_false (g_source_remove_by_user_data ((gpointer)0x1234));
|
g_assert_false (g_source_remove_by_user_data ((gpointer)0x1234));
|
||||||
|
@ -186,14 +186,16 @@ addition_thread (gpointer value)
|
|||||||
static void
|
static void
|
||||||
test_mutex_perf (gconstpointer data)
|
test_mutex_perf (gconstpointer data)
|
||||||
{
|
{
|
||||||
gint n_threads = GPOINTER_TO_INT (data);
|
guint n_threads = GPOINTER_TO_UINT (data);
|
||||||
GThread *threads[THREADS];
|
GThread *threads[THREADS];
|
||||||
gint64 start_time;
|
gint64 start_time;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
gint x = -1;
|
gint x = -1;
|
||||||
gint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 0; i < n_threads - 1; i++)
|
g_assert (n_threads <= G_N_ELEMENTS (threads));
|
||||||
|
|
||||||
|
for (i = 0; n_threads > 0 && i < n_threads - 1; i++)
|
||||||
threads[i] = g_thread_create (addition_thread, &x, TRUE, NULL);
|
threads[i] = g_thread_create (addition_thread, &x, TRUE, NULL);
|
||||||
|
|
||||||
/* avoid measuring thread setup/teardown time */
|
/* avoid measuring thread setup/teardown time */
|
||||||
@ -204,7 +206,7 @@ test_mutex_perf (gconstpointer data)
|
|||||||
rate = g_get_monotonic_time () - start_time;
|
rate = g_get_monotonic_time () - start_time;
|
||||||
rate = x / rate;
|
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_thread_join (threads[i]);
|
||||||
|
|
||||||
g_test_maximized_result (rate, "%f mips", rate);
|
g_test_maximized_result (rate, "%f mips", rate);
|
||||||
@ -223,15 +225,15 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (g_test_perf ())
|
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++)
|
for (i = 1; i <= 10; i++)
|
||||||
{
|
{
|
||||||
gchar name[80];
|
gchar name[80];
|
||||||
sprintf (name, "/thread/mutex/perf/contended/%d", i);
|
sprintf (name, "/thread/mutex/perf/contended/%u", i);
|
||||||
g_test_add_data_func (name, GINT_TO_POINTER (i), test_mutex_perf);
|
g_test_add_data_func (name, GUINT_TO_POINTER (i), test_mutex_perf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,6 +712,7 @@ test_fetch_all (gconstpointer d)
|
|||||||
l_exp = data->expected;
|
l_exp = data->expected;
|
||||||
for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp))
|
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]);
|
g_assert_cmpstr (l_exp->data, ==, matches[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,6 +801,7 @@ test_split_simple (gconstpointer d)
|
|||||||
l_exp = data->expected;
|
l_exp = data->expected;
|
||||||
for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp))
|
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]);
|
g_assert_cmpstr (l_exp->data, ==, tokens[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,6 +885,7 @@ test_split_full (gconstpointer d)
|
|||||||
l_exp = data->expected;
|
l_exp = data->expected;
|
||||||
for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp))
|
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]);
|
g_assert_cmpstr (l_exp->data, ==, tokens[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,6 +918,7 @@ test_split (gconstpointer d)
|
|||||||
l_exp = data->expected;
|
l_exp = data->expected;
|
||||||
for (i = 0; l_exp != NULL; i++, l_exp = g_slist_next (l_exp))
|
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]);
|
g_assert_cmpstr (l_exp->data, ==, tokens[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user