[Spice-commits] 4 commits - server/char-device.c server/dcc.c server/display-channel.c server/glib-compat.h server/Makefile.am server/meson.build server/red-channel-capabilities.c server/red-channel-client.c server/reds.c server/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 26 13:05:42 UTC 2020


 server/Makefile.am                |    1 
 server/char-device.c              |    1 
 server/dcc.c                      |    1 
 server/display-channel.c          |    1 
 server/glib-compat.h              |   67 ----------------------
 server/meson.build                |    1 
 server/red-channel-capabilities.c |    4 -
 server/red-channel-client.c       |    1 
 server/reds.c                     |    1 
 server/tests/Makefile.am          |    1 
 server/tests/meson.build          |    1 
 server/tests/test-glib-compat.c   |  112 --------------------------------------
 server/tests/test-glib-compat.h   |   23 -------
 13 files changed, 215 deletions(-)

New commits:
commit 9e29b724618c01c10b1bbfb909848bd2960dde6a
Author: Victor Toso <me at victortoso.com>
Date:   Tue Feb 18 23:07:37 2020 +0100

    red-channel: no need to call g_type_init()
    
    Since 03d46e9e "build-sys: Raise glib requirement to 2.38" in
    2019-02-05
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red-channel-capabilities.c b/server/red-channel-capabilities.c
index 05b8959c..2a42662e 100644
--- a/server/red-channel-capabilities.c
+++ b/server/red-channel-capabilities.c
@@ -58,10 +58,6 @@ static void red_channel_capabilities_free(RedChannelCapabilities *caps)
 
 SPICE_CONSTRUCTOR_FUNC(red_channel_capabilities_construct)
 {
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
-
     red_channel_capabilities_type =
         g_boxed_type_register_static("RedChannelCapabilities",
                                      (GBoxedCopyFunc) red_channel_capabilities_dup,
commit 0b1a87a6d0996d83a9c897f599d8bdd62b13b5f4
Author: Victor Toso <me at victortoso.com>
Date:   Tue Feb 18 23:00:55 2020 +0100

    Remove unused code since glib bump to 2.38
    
    g_assert_null, g_assert_true and g_assert_false are all defined in
    GLib 2.38
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/tests/test-glib-compat.h b/server/tests/test-glib-compat.h
index 2744fd5a..08418baa 100644
--- a/server/tests/test-glib-compat.h
+++ b/server/tests/test-glib-compat.h
@@ -20,14 +20,6 @@
 
 #include <glib.h>
 
-#if !GLIB_CHECK_VERSION(2, 34, 0)
-void g_test_assert_expected_messages_internal(const char *domain,
-                                              const char *file, int line, const char *func);
-#define g_test_assert_expected_messages() \
-    g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC)
-void g_test_expect_message(const gchar *log_domain, GLogLevelFlags log_level,
-                           const gchar *pattern);
-#else
 /* this avoids deprecation warning */
 static inline void
 g_test_expect_message_no_warnings(const gchar *log_domain, GLogLevelFlags log_level,
@@ -47,24 +39,11 @@ g_test_assert_expected_messages_internal_no_warnings(const char *domain,
 }
 #define g_test_expect_message g_test_expect_message_no_warnings
 #define g_test_assert_expected_messages_internal g_test_assert_expected_messages_internal_no_warnings
-/* g_test_assert_expected_messages defined above is already defined for
- * Glib >= 2.34 so we don't need to define it here */
-#endif
 
 /* GLIB_CHECK_VERSION(2, 40, 0) */
 #ifndef g_assert_nonnull
 #define g_assert_nonnull g_assert
 #endif
-#ifndef g_assert_null
-#define g_assert_null(ptr) g_assert((ptr) == NULL)
-#endif
-
-#ifndef g_assert_true
-#define g_assert_true g_assert
-#endif
-#ifndef g_assert_false
-#define g_assert_false(cond) g_assert(!(cond))
-#endif
 
 /* Added in glib 2.50 */
 #ifndef G_PID_FORMAT
commit e7a2a867798c1e140266febcb4f349a0b037de87
Author: Victor Toso <me at victortoso.com>
Date:   Tue Feb 18 22:56:21 2020 +0100

    tests: remove test-glib-compat.c
    
    Basically not run since 03d46e9e "build-sys: Raise glib requirement to
    2.38" in 2019-02-05
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index dd285c24..d749f888 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -33,7 +33,6 @@ libtest_a_SOURCES =				\
 	basic-event-loop.h			\
 	test-display-base.c			\
 	test-display-base.h			\
-	test-glib-compat.c			\
 	test-glib-compat.h			\
 	win-alarm.c				\
 	win-alarm.h				\
diff --git a/server/tests/meson.build b/server/tests/meson.build
index 95ade60f..09ba0f22 100644
--- a/server/tests/meson.build
+++ b/server/tests/meson.build
@@ -9,7 +9,6 @@ test_lib_sources = [
   'basic-event-loop.h',
   'test-display-base.c',
   'test-display-base.h',
-  'test-glib-compat.c',
   'test-glib-compat.h',
   'win-alarm.c',
   'win-alarm.h',
diff --git a/server/tests/test-glib-compat.c b/server/tests/test-glib-compat.c
deleted file mode 100644
index 0b2008b7..00000000
--- a/server/tests/test-glib-compat.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2017 Red Hat, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <config.h>
-
-#include "test-glib-compat.h"
-
-#if !GLIB_CHECK_VERSION(2, 34, 0)
-
-/* The code in this #ifdef block is taken from glib and is licensed under the
- * GNU Lesser General Public License version 2 or later.
- *
- * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
- * Modified by the GLib Team and others 1997-2000.  See GLib AUTHORS
- * file for a list of people on the GLib Team.
- */
-
-typedef struct {
-    gchar *log_domain;
-    GLogLevelFlags log_level;
-    gchar *pattern;
-} GTestExpectedMessage;
-
-static GSList *expected_messages = NULL;
-
-static gboolean fatal_log_filter(const gchar *log_domain,
-                                 GLogLevelFlags log_level,
-                                 const gchar *msg,
-                                 gpointer user_data)
-{
-    GTestExpectedMessage *expected = expected_messages->data;
-
-    if ((g_strcmp0(expected->log_domain, log_domain) == 0)
-            && ((log_level & expected->log_level) == expected->log_level)
-            && (g_pattern_match_simple(expected->pattern, msg))) {
-        expected_messages = g_slist_delete_link(expected_messages,
-                                                expected_messages);
-        g_free (expected->log_domain);
-        g_free (expected->pattern);
-        g_free (expected);
-
-        return FALSE;
-    }
-    return TRUE;
-}
-
-void
-g_test_assert_expected_messages_internal (const char     *domain,
-                                          const char     *file,
-                                          int             line,
-                                          const char     *func)
-{
-  if (expected_messages)
-    {
-      GTestExpectedMessage *expected;
-      gchar *message;
-
-      expected = expected_messages->data;
-
-      message = g_strdup_printf ("Did not see expected message %s: %s",
-                                 expected->log_domain ? expected->log_domain : "**",
-                                 expected->pattern);
-      g_error ("%s", message);
-      g_free (message);
-    }
-}
-
-#define g_test_assert_expected_messages() g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC)
-
-void
-g_test_expect_message (const gchar    *log_domain,
-                       GLogLevelFlags  log_level,
-                       const gchar    *pattern)
-{
-  GTestExpectedMessage *expected;
-
-  g_return_if_fail (log_level != 0);
-  g_return_if_fail (pattern != NULL);
-  g_return_if_fail (~log_level & G_LOG_LEVEL_ERROR);
-
-  if (expected_messages == NULL)
-    {
-      g_test_log_set_fatal_handler(fatal_log_filter, NULL);
-    }
-
-  expected = g_new (GTestExpectedMessage, 1);
-  expected->log_domain = g_strdup (log_domain);
-  expected->log_level = log_level;
-  expected->pattern = g_strdup (pattern);
-
-  if ((log_level & G_LOG_LEVEL_MASK) <= G_LOG_LEVEL_WARNING)
-    {
-      expected_messages = g_slist_append (expected_messages, expected);
-    }
-}
-
-#endif /* GLIB_CHECK_VERSION(2, 34, 0) */
commit 7848ee3faf207aba4d07526703e0aa1c9d26c224
Author: Victor Toso <me at victortoso.com>
Date:   Tue Feb 18 22:49:28 2020 +0100

    Remove glib-compat.h
    
    Not used since 03d46e9e "build-sys: Raise glib requirement to 2.38" in
    2019-02-05
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/Makefile.am b/server/Makefile.am
index 075b8784..2d148c14 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -97,7 +97,6 @@ libserver_la_SOURCES =				\
 	display-channel-private.h		\
 	display-limits.h			\
 	event-loop.c				\
-	glib-compat.h				\
 	glz-encoder.c				\
 	glz-encoder-dict.c			\
 	glz-encoder-dict.h			\
diff --git a/server/char-device.c b/server/char-device.c
index 0aae89d1..7d267c60 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -29,7 +29,6 @@ typedef struct RedCharDeviceClientOpaque RedCharDeviceClientOpaque;
 
 #include "char-device.h"
 #include "reds.h"
-#include "glib-compat.h"
 
 #define CHAR_DEVICE_WRITE_TO_TIMEOUT 100
 #define RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000
diff --git a/server/dcc.c b/server/dcc.c
index ba98331d..6d16da0e 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -24,7 +24,6 @@
 #include "red-client.h"
 #include "main-channel-client.h"
 #include <spice-server-enums.h>
-#include "glib-compat.h"
 
 G_DEFINE_TYPE(DisplayChannelClient, display_channel_client, TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT)
 
diff --git a/server/display-channel.c b/server/display-channel.c
index 75266598..71a9d9a9 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -19,7 +19,6 @@
 #include <common/sw_canvas.h>
 
 #include "display-channel-private.h"
-#include "glib-compat.h"
 #include "red-qxl.h"
 
 G_DEFINE_TYPE(DisplayChannel, display_channel, TYPE_COMMON_GRAPHICS_CHANNEL)
diff --git a/server/glib-compat.h b/server/glib-compat.h
deleted file mode 100644
index 2444ac3b..00000000
--- a/server/glib-compat.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2016 Red Hat, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef GLIB_COMPAT_H_
-#define GLIB_COMPAT_H_
-
-#include <glib.h>
-
-#if !GLIB_CHECK_VERSION(2,34,0)
-#define g_clear_pointer(pp, destroy) \
-  G_STMT_START {                                                               \
-    SPICE_VERIFY (sizeof *(pp) == sizeof (gpointer));                          \
-    /* Only one access, please */                                              \
-    gpointer *_pp = (gpointer *) (pp);                                         \
-    gpointer _p;                                                               \
-    /* This assignment is needed to avoid a gcc warning */                     \
-    GDestroyNotify _destroy = (GDestroyNotify) (destroy);                      \
-                                                                               \
-    _p = *_pp;                                                                 \
-    if (_p)                                                                    \
-      {                                                                        \
-        *_pp = NULL;                                                           \
-        _destroy (_p);                                                         \
-      }                                                                        \
-  } G_STMT_END
-#endif
-
-#if !GLIB_CHECK_VERSION(2,32,0)
-static inline void
-g_queue_free_full(GQueue *queue, GDestroyNotify free_func)
-{
-    /* quite hack cast but work with standard C call convention */
-    g_queue_foreach(queue, (GFunc) free_func, NULL);
-    g_queue_clear(queue);
-}
-#endif
-
-#if !GLIB_CHECK_VERSION(2,30,0)
-static inline gboolean
-g_queue_remove_boolean(GQueue *queue, gconstpointer data)
-{
-    GList *link = g_queue_find(queue, data);
-    if (!link) {
-        return FALSE;
-    }
-    g_queue_unlink(queue, link);
-    return TRUE;
-}
-#define g_queue_remove g_queue_remove_boolean
-#endif
-
-#endif /* GLIB_COMPAT_H_ */
diff --git a/server/meson.build b/server/meson.build
index 395811c8..b2eb410c 100644
--- a/server/meson.build
+++ b/server/meson.build
@@ -67,7 +67,6 @@ spice_server_sources = [
   'display-channel-private.h',
   'display-limits.h',
   'event-loop.c',
-  'glib-compat.h',
   'glz-encoder.c',
   'glz-encoder-dict.c',
   'glz-encoder-dict.h',
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 235085cc..5d61a824 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -35,7 +35,6 @@
 
 #include "red-channel-client.h"
 #include "red-client.h"
-#include "glib-compat.h"
 
 #define CLIENT_ACK_WINDOW 20
 
diff --git a/server/reds.c b/server/reds.c
index 8f835fe2..ee8cf387 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -75,7 +75,6 @@
 #include "red-channel-client.h"
 #include "main-channel-client.h"
 #include "red-client.h"
-#include "glib-compat.h"
 #include "net-utils.h"
 #include "red-stream-device.h"
 
diff --git a/server/tests/test-glib-compat.h b/server/tests/test-glib-compat.h
index 17ebcf48..2744fd5a 100644
--- a/server/tests/test-glib-compat.h
+++ b/server/tests/test-glib-compat.h
@@ -20,8 +20,6 @@
 
 #include <glib.h>
 
-#include "glib-compat.h"
-
 #if !GLIB_CHECK_VERSION(2, 34, 0)
 void g_test_assert_expected_messages_internal(const char *domain,
                                               const char *file, int line, const char *func);


More information about the Spice-commits mailing list