summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2017-02-02 16:46:09 -0800
committerAleksander Morgado <aleksander@aleksander.es>2017-02-03 09:45:11 +0100
commitd2cd0a2a2feb64548c9d3d2b2e1d781b652fd4eb (patch)
treeb43c63d36470770f5ad758621fd88b01cb04c662
parentf5a34e57f6c543e893366c987402b9d4a56d96b0 (diff)
glib: guard invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute 'deprecated') since glib 2.36 as the type system is automatically initialized. Since the minimum version of glib required by libmbim is 2.32, calling g_type_init() should be guarded with the GLIB_CHECK_VERSION macro. When libmbim later requires at least glib 2.36, we can completely remove all invocations of g_type_init() from the code.
-rw-r--r--src/mbim-proxy/mbim-proxy.c2
-rw-r--r--src/mbimcli/mbimcli.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/mbim-proxy/mbim-proxy.c b/src/mbim-proxy/mbim-proxy.c
index f29303f..2e8eeb9 100644
--- a/src/mbim-proxy/mbim-proxy.c
+++ b/src/mbim-proxy/mbim-proxy.c
@@ -196,7 +196,9 @@ int main (int argc, char **argv)
setlocale (LC_ALL, "");
+#if !GLIB_CHECK_VERSION (2, 36, 0)
g_type_init ();
+#endif
/* Setup option context, process it and destroy it */
context = g_option_context_new ("- Proxy for MBIM devices");
diff --git a/src/mbimcli/mbimcli.c b/src/mbimcli/mbimcli.c
index 9906693..a265895 100644
--- a/src/mbimcli/mbimcli.c
+++ b/src/mbimcli/mbimcli.c
@@ -372,7 +372,9 @@ int main (int argc, char **argv)
setlocale (LC_ALL, "");
+#if !GLIB_CHECK_VERSION (2, 36, 0)
g_type_init ();
+#endif
/* Setup option context, process it and destroy it */
context = g_option_context_new ("- Control MBIM devices");