[Spice-devel] [PATCH spice-common] Obsolete Glib cleanup

Frediano Ziglio fziglio at redhat.com
Wed Feb 6 13:32:19 UTC 2019


We require at least GLib 2.38, remove code and check to
support earlier versions.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 common/log.c         | 8 --------
 tests/test-logging.c | 4 ----
 2 files changed, 12 deletions(-)

diff --git a/common/log.c b/common/log.c
index f9cdd60..054fd7f 100644
--- a/common/log.c
+++ b/common/log.c
@@ -36,14 +36,6 @@
 
 SPICE_CONSTRUCTOR_FUNC(spice_log_init)
 {
-    /* Threading is always enabled from 2.31.0 onwards */
-    /* Our logging is potentially used from different threads.
-     * Older glibs require that g_thread_init() is called when
-     * doing that. */
-#if !GLIB_CHECK_VERSION(2, 31, 0)
-    if (!g_thread_supported())
-        g_thread_init(NULL);
-#endif
     recorder_dump_on_common_signals(0, 0);
 }
 
diff --git a/tests/test-logging.c b/tests/test-logging.c
index ff2d8bd..6a79ca9 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -43,7 +43,6 @@ LOG_OTHER_HELPER(message, MESSAGE)
 LOG_OTHER_HELPER(warning, WARNING)
 LOG_OTHER_HELPER(critical, CRITICAL)
 
-#if GLIB_CHECK_VERSION(2,38,0)
 /* Checks that spice_warning() aborts after setting G_DEBUG=fatal-warnings */
 static void test_spice_fatal_warning(void)
 {
@@ -268,7 +267,6 @@ static void test_spice_g_messages_debug_all(void)
     g_test_trap_assert_stdout("*spice_debug\n*spice_info\n*g_debug\n*g_info\n*other_debug\n*other_info\n");
     g_test_trap_assert_stderr("*g_message\n*other_message\n");
 }
-#endif /* GLIB_CHECK_VERSION(2,38,0) */
 
 static void handle_sigabrt(int sig G_GNUC_UNUSED)
 {
@@ -292,7 +290,6 @@ int main(int argc, char **argv)
      * test cases are going to test */
     g_log_set_always_fatal(fatal_mask & G_LOG_LEVEL_MASK);
 
-#if GLIB_CHECK_VERSION(2,38,0)
     g_test_add_func("/spice-common/spice-g-messages-debug", test_spice_g_messages_debug);
     g_test_add_func("/spice-common/spice-g-messages-debug-all", test_spice_g_messages_debug_all);
     g_test_add_func("/spice-common/spice-log-levels", test_log_levels);
@@ -302,7 +299,6 @@ int main(int argc, char **argv)
     g_test_add_func("/spice-common/spice-fatal-return-if-fail", test_spice_fatal_return_if_fail);
     g_test_add_func("/spice-common/spice-non-fatal-greturn-if-fail", test_spice_non_fatal_g_return_if_fail);
     g_test_add_func("/spice-common/spice-fatal-warning", test_spice_fatal_warning);
-#endif /* GLIB_CHECK_VERSION(2,38,0) */
 
     return g_test_run();
 }
-- 
2.20.1



More information about the Spice-devel mailing list