[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-glib 1/5] Don't call g_type_init on newer glib



This function call is deprecated and calling it causes a compilation
warning.
---
 libvirt-gconfig/Makefile.am               |  1 +
 libvirt-gconfig/libvirt-gconfig-compat.h  | 32 +++++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-main.c    |  1 +
 libvirt-gconfig/tests/test-domain-parse.c |  2 --
 libvirt-gobject/libvirt-gobject-main.c    |  1 +
 5 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-compat.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index caa62f0..507e733 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -76,6 +76,7 @@ GCONFIG_HEADER_FILES = \
 noinst_HEADERS = \
 			libvirt-gconfig-private.h \
 			libvirt-gconfig-capabilities-cpu-private.h \
+			libvirt-gconfig-compat.h \
 			libvirt-gconfig-domain-device-private.h \
 			libvirt-gconfig-helpers-private.h \
 			libvirt-gconfig-object-private.h \
diff --git a/libvirt-gconfig/libvirt-gconfig-compat.h b/libvirt-gconfig/libvirt-gconfig-compat.h
new file mode 100644
index 0000000..85a420d
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-compat.h
@@ -0,0 +1,32 @@
+/*
+ * libvirt-gconfig-compat.h: libvirt configuration
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau redhat com>
+ */
+
+#ifndef __LIBVIRT_GCONFIG_COMPAT_H__
+#define __LIBVIRT_GCONFIG_COMPAT_H__
+
+#include <glib-object.h>
+
+#if GLIB_CHECK_VERSION(2, 34, 0)
+#define g_type_init()
+#endif
+
+#endif /* __LIBVIRT_GCONFIG_COMPAT_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-main.c b/libvirt-gconfig/libvirt-gconfig-main.c
index 6fca85c..fa1963c 100644
--- a/libvirt-gconfig/libvirt-gconfig-main.c
+++ b/libvirt-gconfig/libvirt-gconfig-main.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-compat.h"
 
 /**
  * gvirt_config_init:
diff --git a/libvirt-gconfig/tests/test-domain-parse.c b/libvirt-gconfig/tests/test-domain-parse.c
index 11880de..33fc7be 100644
--- a/libvirt-gconfig/tests/test-domain-parse.c
+++ b/libvirt-gconfig/tests/test-domain-parse.c
@@ -52,8 +52,6 @@ int main(int argc, char **argv)
         return 2;
     }
 
-    g_type_init();
-
     domain = gvir_config_domain_new_from_xml(xml, &error);
     if (error != NULL) {
         g_print("Couldn't parse %s: %s\n", argv[1], error->message);
diff --git a/libvirt-gobject/libvirt-gobject-main.c b/libvirt-gobject/libvirt-gobject-main.c
index 9dd6e3c..8544124 100644
--- a/libvirt-gobject/libvirt-gobject-main.c
+++ b/libvirt-gobject/libvirt-gobject-main.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gconfig/libvirt-gconfig-compat.h"
 
 /**
  * gvir_init_object:
-- 
1.8.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]