From 977cee72d865cf4353bef10ff1719546055022ec Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 4 Jan 2020 08:40:19 +0100 Subject: [PATCH] shared/tests: use nmtst_g_source_set_boolean_true() in nmtst_main_context_iterate_until() (cherry picked from commit eceaa39a1efd33e3bdf14fe04624245d591f6582) (cherry picked from commit 8673206f825932af45112f21940b22f8ce54dbe5) --- shared/nm-utils/nm-test-utils.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h index fb27d441ed..97cfe91e54 100644 --- a/shared/nm-utils/nm-test-utils.h +++ b/shared/nm-utils/nm-test-utils.h @@ -1044,24 +1044,14 @@ _nmtst_main_loop_quit_on_notify (GObject *object, GParamSpec *pspec, gpointer us } #define nmtst_main_loop_quit_on_notify ((GCallback) _nmtst_main_loop_quit_on_notify) -static inline gboolean -_nmtst_main_context_iterate_until_timeout (gpointer user_data) -{ - gboolean *p_had_pointer = user_data; - - g_assert (!*p_had_pointer); - *p_had_pointer = TRUE; - return G_SOURCE_CONTINUE; -} - -#define nmtst_main_context_iterate_until(context, timeout_ms, condition) \ +#define nmtst_main_context_iterate_until(context, timeout_msec, condition) \ G_STMT_START { \ nm_auto_destroy_and_unref_gsource GSource *_source = NULL; \ GMainContext *_context = (context); \ gboolean _had_timeout = FALSE; \ \ - _source = g_timeout_source_new (timeout_ms); \ - g_source_set_callback (_source, _nmtst_main_context_iterate_until_timeout, &_had_timeout, NULL); \ + _source = g_timeout_source_new (timeout_msec); \ + g_source_set_callback (_source, nmtst_g_source_set_boolean_true, &_had_timeout, NULL); \ g_source_attach (_source, _context); \ \ while (TRUE) { \