peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0111-glib-move-g_poll-replacement-into-glib-compat.h.patch

0410ae
From 6c1369c499e74fccbbfb97b3ec3e5da59d382031 Mon Sep 17 00:00:00 2001
0410ae
From: Stefan Hajnoczi <stefanha@redhat.com>
0410ae
Date: Fri, 2 May 2014 18:35:56 +0400
0410ae
Subject: [PATCH] glib: move g_poll() replacement into glib-compat.h
0410ae
0410ae
We have a dedicated header file for wrappers to smooth over glib version
0410ae
differences.  Move the g_poll() definition into glib-compat.h for
0410ae
consistency.
0410ae
0410ae
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0410ae
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
0410ae
Cc: qemu-trivial@nongnu.org
0410ae
(cherry picked from commit f95c967a7950797109d2a96fcfa2e3a2899f2c99)
0410ae
---
0410ae
 include/glib-compat.h | 12 ++++++++++++
0410ae
 include/qemu-common.h | 12 ------------
0410ae
 2 files changed, 12 insertions(+), 12 deletions(-)
0410ae
0410ae
diff --git a/include/glib-compat.h b/include/glib-compat.h
0410ae
index 8aa77af..8d25900 100644
0410ae
--- a/include/glib-compat.h
0410ae
+++ b/include/glib-compat.h
0410ae
@@ -24,4 +24,16 @@ static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function,
0410ae
 }
0410ae
 #endif
0410ae
 
0410ae
+#if !GLIB_CHECK_VERSION(2, 20, 0)
0410ae
+/*
0410ae
+ * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
0410ae
+ * on older systems.
0410ae
+ */
0410ae
+static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
0410ae
+{
0410ae
+    GMainContext *ctx = g_main_context_default();
0410ae
+    return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
0410ae
+}
0410ae
+#endif
0410ae
+
0410ae
 #endif
0410ae
diff --git a/include/qemu-common.h b/include/qemu-common.h
0410ae
index a998e8d..3f3fd60 100644
0410ae
--- a/include/qemu-common.h
0410ae
+++ b/include/qemu-common.h
0410ae
@@ -124,18 +124,6 @@ int qemu_main(int argc, char **argv, char **envp);
0410ae
 void qemu_get_timedate(struct tm *tm, int offset);
0410ae
 int qemu_timedate_diff(struct tm *tm);
0410ae
 
0410ae
-#if !GLIB_CHECK_VERSION(2, 20, 0)
0410ae
-/*
0410ae
- * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly
0410ae
- * on older systems.
0410ae
- */
0410ae
-static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout)
0410ae
-{
0410ae
-    GMainContext *ctx = g_main_context_default();
0410ae
-    return g_main_context_get_poll_func(ctx)(fds, nfds, timeout);
0410ae
-}
0410ae
-#endif
0410ae
-
0410ae
 /**
0410ae
  * is_help_option:
0410ae
  * @s: string to test