[PATCH] glib: remove invocations of g_type_init()

Aleksander Morgado aleksander at aleksander.es
Fri Feb 3 09:06:05 UTC 2017


On 03/02/17 01:45, Ben Chan wrote:
> 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 ModemManager
> is 2.36, calling g_type_init() isn't necessarily in the ModemManager
> code.

Pushed, thanks.

> ---
>  cli/mmcli.c                                            | 2 --
>  libmm-glib/tests/test-common-helpers.c                 | 1 -
>  plugins/altair/tests/test-modem-helpers-altair-lte.c   | 1 -
>  plugins/cinterion/tests/test-modem-helpers-cinterion.c | 1 -
>  plugins/generic/tests/test-service-generic.c           | 1 -
>  plugins/huawei/tests/test-modem-helpers-huawei.c       | 1 -
>  plugins/icera/tests/test-modem-helpers-icera.c         | 1 -
>  plugins/linktop/tests/test-modem-helpers-linktop.c     | 1 -
>  plugins/mbm/tests/test-modem-helpers-mbm.c             | 1 -
>  plugins/telit/tests/test-mm-modem-helpers-telit.c      | 1 -
>  plugins/tests/test-udev-rules.c                        | 1 -
>  plugins/thuraya/tests/test-mm-modem-helpers-thuraya.c  | 1 -
>  plugins/ublox/tests/test-modem-helpers-ublox.c         | 1 -
>  src/main.c                                             | 2 --
>  src/tests/test-at-serial-port.c                        | 1 -
>  src/tests/test-modem-helpers-qmi.c                     | 1 -
>  src/tests/test-modem-helpers.c                         | 1 -
>  src/tests/test-qcdm-serial-port.c                      | 3 ---
>  src/tests/test-sms-part-3gpp.c                         | 1 -
>  src/tests/test-sms-part-cdma.c                         | 1 -
>  src/tests/test-udev-rules.c                            | 1 -
>  test/lsudev.c                                          | 2 --
>  test/mmrules.c                                         | 2 --
>  test/mmtty.c                                           | 2 --
>  24 files changed, 31 deletions(-)
> 
> diff --git a/cli/mmcli.c b/cli/mmcli.c
> index 85fc8925..f5077538 100644
> --- a/cli/mmcli.c
> +++ b/cli/mmcli.c
> @@ -184,8 +184,6 @@ main (gint argc, gchar **argv)
>  
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
> -
>      /* Setup option context, process it and destroy it */
>      context = g_option_context_new ("- Control and monitor the ModemManager");
>      g_option_context_add_group (context,
> diff --git a/libmm-glib/tests/test-common-helpers.c b/libmm-glib/tests/test-common-helpers.c
> index 9b71e6b9..aa15b172 100644
> --- a/libmm-glib/tests/test-common-helpers.c
> +++ b/libmm-glib/tests/test-common-helpers.c
> @@ -490,7 +490,6 @@ field_parser_double (void)
>  
>  int main (int argc, char **argv)
>  {
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/Common/KeyValue/standard", key_value_test_standard);
> diff --git a/plugins/altair/tests/test-modem-helpers-altair-lte.c b/plugins/altair/tests/test-modem-helpers-altair-lte.c
> index d83d3e50..4d038ce1 100644
> --- a/plugins/altair/tests/test-modem-helpers-altair-lte.c
> +++ b/plugins/altair/tests/test-modem-helpers-altair-lte.c
> @@ -142,7 +142,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/altair/parse_bands", test_parse_bands);
> diff --git a/plugins/cinterion/tests/test-modem-helpers-cinterion.c b/plugins/cinterion/tests/test-modem-helpers-cinterion.c
> index 23739516..022fec38 100644
> --- a/plugins/cinterion/tests/test-modem-helpers-cinterion.c
> +++ b/plugins/cinterion/tests/test-modem-helpers-cinterion.c
> @@ -541,7 +541,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/cinterion/scfg",                    test_scfg);
> diff --git a/plugins/generic/tests/test-service-generic.c b/plugins/generic/tests/test-service-generic.c
> index 8c21cd05..c6e4277a 100644
> --- a/plugins/generic/tests/test-service-generic.c
> +++ b/plugins/generic/tests/test-service-generic.c
> @@ -82,7 +82,6 @@ test_enable_disable (TestFixture *fixture)
>  int main (int   argc,
>            char *argv[])
>  {
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      TEST_ADD ("/MM/Service/Generic/enable-disable", test_enable_disable);
> diff --git a/plugins/huawei/tests/test-modem-helpers-huawei.c b/plugins/huawei/tests/test-modem-helpers-huawei.c
> index 7044582d..46c90f44 100644
> --- a/plugins/huawei/tests/test-modem-helpers-huawei.c
> +++ b/plugins/huawei/tests/test-modem-helpers-huawei.c
> @@ -1291,7 +1291,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/huawei/ndisstatqry", test_ndisstatqry);
> diff --git a/plugins/icera/tests/test-modem-helpers-icera.c b/plugins/icera/tests/test-modem-helpers-icera.c
> index 2e7b26fc..3761b029 100644
> --- a/plugins/icera/tests/test-modem-helpers-icera.c
> +++ b/plugins/icera/tests/test-modem-helpers-icera.c
> @@ -199,7 +199,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/icera/ipdpaddr", test_ipdpaddr);
> diff --git a/plugins/linktop/tests/test-modem-helpers-linktop.c b/plugins/linktop/tests/test-modem-helpers-linktop.c
> index 3a5797e7..27119bbb 100644
> --- a/plugins/linktop/tests/test-modem-helpers-linktop.c
> +++ b/plugins/linktop/tests/test-modem-helpers-linktop.c
> @@ -85,7 +85,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/linktop/cfun/query/current-modes", test_cfun_query_current_modes);
> diff --git a/plugins/mbm/tests/test-modem-helpers-mbm.c b/plugins/mbm/tests/test-modem-helpers-mbm.c
> index df49ca7e..8c573af4 100644
> --- a/plugins/mbm/tests/test-modem-helpers-mbm.c
> +++ b/plugins/mbm/tests/test-modem-helpers-mbm.c
> @@ -279,7 +279,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/mbm/e2ipcfg",                  test_e2ipcfg);
> diff --git a/plugins/telit/tests/test-mm-modem-helpers-telit.c b/plugins/telit/tests/test-mm-modem-helpers-telit.c
> index 88a889e6..40e36289 100644
> --- a/plugins/telit/tests/test-mm-modem-helpers-telit.c
> +++ b/plugins/telit/tests/test-mm-modem-helpers-telit.c
> @@ -515,7 +515,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/telit/csim", test_mm_telit_parse_csim_response);
> diff --git a/plugins/tests/test-udev-rules.c b/plugins/tests/test-udev-rules.c
> index 369e22bb..b32ceef1 100644
> --- a/plugins/tests/test-udev-rules.c
> +++ b/plugins/tests/test-udev-rules.c
> @@ -144,7 +144,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/test-udev-rules/huawei",    test_huawei);
> diff --git a/plugins/thuraya/tests/test-mm-modem-helpers-thuraya.c b/plugins/thuraya/tests/test-mm-modem-helpers-thuraya.c
> index f3a7ea42..bc05b7c2 100644
> --- a/plugins/thuraya/tests/test-mm-modem-helpers-thuraya.c
> +++ b/plugins/thuraya/tests/test-mm-modem-helpers-thuraya.c
> @@ -118,7 +118,6 @@ int main (int argc, char **argv)
>      GTestSuite *suite;
>      gint result;
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      suite = g_test_get_root ();
> diff --git a/plugins/ublox/tests/test-modem-helpers-ublox.c b/plugins/ublox/tests/test-modem-helpers-ublox.c
> index 34896afc..703e915b 100644
> --- a/plugins/ublox/tests/test-modem-helpers-ublox.c
> +++ b/plugins/ublox/tests/test-modem-helpers-ublox.c
> @@ -828,7 +828,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/ublox/upincnt/response",  test_upincnt_response);
> diff --git a/src/main.c b/src/main.c
> index d83baaf9..ada3927c 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -136,8 +136,6 @@ main (int argc, char *argv[])
>      GError *err = NULL;
>      guint name_id;
>  
> -    g_type_init ();
> -
>      /* Setup application context */
>      mm_context_init (argc, argv);
>  
> diff --git a/src/tests/test-at-serial-port.c b/src/tests/test-at-serial-port.c
> index c0be5fa1..2173f207 100644
> --- a/src/tests/test-at-serial-port.c
> +++ b/src/tests/test-at-serial-port.c
> @@ -86,7 +86,6 @@ _mm_log (const char *loc,
>  
>  int main (int argc, char **argv)
>  {
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/ModemManager/AT-serial/echo-removal", at_serial_echo_removal);
> diff --git a/src/tests/test-modem-helpers-qmi.c b/src/tests/test-modem-helpers-qmi.c
> index 0f020f39..f85430c6 100644
> --- a/src/tests/test-modem-helpers-qmi.c
> +++ b/src/tests/test-modem-helpers-qmi.c
> @@ -333,7 +333,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/QMI/Current-Capabilities/UML290",      test_uml290);
> diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
> index cd5ddfa1..fdcac10e 100644
> --- a/src/tests/test-modem-helpers.c
> +++ b/src/tests/test-modem-helpers.c
> @@ -3387,7 +3387,6 @@ int main (int argc, char **argv)
>      gint result;
>      DevidItem *item = &devids[0];
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      suite = g_test_get_root ();
> diff --git a/src/tests/test-qcdm-serial-port.c b/src/tests/test-qcdm-serial-port.c
> index 1f88fad9..ac73a5bf 100644
> --- a/src/tests/test-qcdm-serial-port.c
> +++ b/src/tests/test-qcdm-serial-port.c
> @@ -213,9 +213,6 @@ qcdm_test_child (int fd, GAsyncReadyCallback cb)
>      gboolean success;
>      GError *error = NULL;
>  
> -    /* In the child */
> -    g_type_init ();
> -
>      loop = g_main_loop_new (NULL, FALSE);
>  
>      port = mm_port_serial_qcdm_new_fd (fd);
> diff --git a/src/tests/test-sms-part-3gpp.c b/src/tests/test-sms-part-3gpp.c
> index 21822f09..dcf4cc87 100644
> --- a/src/tests/test-sms-part-3gpp.c
> +++ b/src/tests/test-sms-part-3gpp.c
> @@ -865,7 +865,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/SMS/3GPP/PDU-Parser/pdu1", test_pdu1);
> diff --git a/src/tests/test-sms-part-cdma.c b/src/tests/test-sms-part-cdma.c
> index 17d78966..91b7c3ce 100644
> --- a/src/tests/test-sms-part-cdma.c
> +++ b/src/tests/test-sms-part-cdma.c
> @@ -529,7 +529,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/pdu1", test_pdu1);
> diff --git a/src/tests/test-udev-rules.c b/src/tests/test-udev-rules.c
> index 469885df..07e9b8db 100644
> --- a/src/tests/test-udev-rules.c
> +++ b/src/tests/test-udev-rules.c
> @@ -70,7 +70,6 @@ int main (int argc, char **argv)
>  {
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
>      g_test_init (&argc, &argv, NULL);
>  
>      g_test_add_func ("/MM/test-udev-rules/load-cleanup-core", test_load_cleanup_core);
> diff --git a/test/lsudev.c b/test/lsudev.c
> index b4ff790b..7b8860e1 100644
> --- a/test/lsudev.c
> +++ b/test/lsudev.c
> @@ -156,8 +156,6 @@ main (int argc, char *argv[])
>  		return 1;
>  	}
>  
> -	g_type_init ();
> -
>  	loop = g_main_loop_new (NULL, FALSE);
>  
>  	setup_signals ();
> diff --git a/test/mmrules.c b/test/mmrules.c
> index f8c4c3e4..08b7c00f 100644
> --- a/test/mmrules.c
> +++ b/test/mmrules.c
> @@ -136,8 +136,6 @@ int main (int argc, char **argv)
>  
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
> -
>      /* Setup option context, process it and destroy it */
>      context = g_option_context_new ("- ModemManager udev rules testing");
>      g_option_context_add_main_entries (context, main_entries, NULL);
> diff --git a/test/mmtty.c b/test/mmtty.c
> index 7947f814..966225c7 100644
> --- a/test/mmtty.c
> +++ b/test/mmtty.c
> @@ -259,8 +259,6 @@ int main (int argc, char **argv)
>  
>      setlocale (LC_ALL, "");
>  
> -    g_type_init ();
> -
>      /* Setup option context, process it and destroy it */
>      context = g_option_context_new ("- ModemManager TTY testing");
>      g_option_context_add_main_entries (context, main_entries, NULL);
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list