diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-02-03 09:55:10 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-02-03 09:59:56 +0100 |
commit | aa64138d33e97b74f5f16f1bf620d2b3caa1fe81 (patch) | |
tree | f4890a127cdce03d92098caaab5a8a9275609d3d | |
parent | ca5433a574ed0f0a23286aacdb705da41bdaa725 (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 libqmi is
2.32, calling g_type_init() should be guarded with the
GLIB_CHECK_VERSION macro.
Reported-by: Ben Chan <benchan@chromium.org>
(cherry picked from commit 8b13a1062de0dc3facfbd5fbd1cd6ab77bbf1a95)
-rw-r--r-- | src/libqmi-glib/test/test-generated.c | 3 | ||||
-rw-r--r-- | src/libqmi-glib/test/test-message.c | 3 | ||||
-rw-r--r-- | src/libqmi-glib/test/test-utils.c | 3 | ||||
-rw-r--r-- | src/qmi-proxy/qmi-proxy.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli.c | 2 |
5 files changed, 13 insertions, 0 deletions
diff --git a/src/libqmi-glib/test/test-generated.c b/src/libqmi-glib/test/test-generated.c index a6d0a0a..08e53f6 100644 --- a/src/libqmi-glib/test/test-generated.c +++ b/src/libqmi-glib/test/test-generated.c @@ -648,7 +648,10 @@ test_generated_nas_get_cell_location_info (TestFixture *fixture) int main (int argc, char **argv) { +#if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); +#endif + g_test_init (&argc, &argv, NULL); /* Test the setup/teardown test methods */ diff --git a/src/libqmi-glib/test/test-message.c b/src/libqmi-glib/test/test-message.c index e058343..a69549f 100644 --- a/src/libqmi-glib/test/test-message.c +++ b/src/libqmi-glib/test/test-message.c @@ -1505,7 +1505,10 @@ test_message_set_transaction_id_services (void) int main (int argc, char **argv) { +#if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); +#endif + g_test_init (&argc, &argv, NULL); g_test_add_func ("/libqmi-glib/message/parse/short", test_message_parse_short); diff --git a/src/libqmi-glib/test/test-utils.c b/src/libqmi-glib/test/test-utils.c index 04f552f..95748ae 100644 --- a/src/libqmi-glib/test/test-utils.c +++ b/src/libqmi-glib/test/test-utils.c @@ -1211,7 +1211,10 @@ test_utils_uint_sized_8_unaligned_be (void) int main (int argc, char **argv) { +#if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); +#endif + g_test_init (&argc, &argv, NULL); g_test_add_func ("/libqmi-glib/utils/uint8", test_utils_uint8); diff --git a/src/qmi-proxy/qmi-proxy.c b/src/qmi-proxy/qmi-proxy.c index fe51075..5a2129b 100644 --- a/src/qmi-proxy/qmi-proxy.c +++ b/src/qmi-proxy/qmi-proxy.c @@ -174,7 +174,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 QMI devices"); diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c index 748bba3..c0b1341 100644 --- a/src/qmicli/qmicli.c +++ b/src/qmicli/qmicli.c @@ -700,7 +700,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 QMI devices"); |