diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-05 20:01:30 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:46 +0100 |
commit | e8aeb59293063cb4cfedddcaf27da665f9d968e0 (patch) | |
tree | c9b0c4097f8ccf28e73f144b426c3b2d72bfc8d8 | |
parent | 20acb274dcd1924d64b56021fd0c3125c95d9fee (diff) |
cli: use g_list_free_full() when possible
-rw-r--r-- | cli/mmcli-common.c | 21 | ||||
-rw-r--r-- | cli/mmcli-manager.c | 3 | ||||
-rw-r--r-- | cli/mmcli-modem-3gpp.c | 3 |
3 files changed, 9 insertions, 18 deletions
diff --git a/cli/mmcli-common.c b/cli/mmcli-common.c index 33127699..4b798733 100644 --- a/cli/mmcli-common.c +++ b/cli/mmcli-common.c @@ -129,8 +129,7 @@ find_modem (MMManager *manager, break; } } - g_list_foreach (modems, (GFunc)g_object_unref, NULL); - g_list_free (modems); + g_list_free_full (modems, (GDestroyNotify) g_object_unref); if (!found) { g_printerr ("error: couldn't find modem at '%s'\n", modem_path); @@ -289,8 +288,7 @@ get_bearer_context_free (GetBearerContext *ctx) g_object_unref (ctx->manager); if (ctx->bearer) g_object_unref (ctx->bearer); - g_list_foreach (ctx->modems, (GFunc)g_object_unref, NULL); - g_list_free (ctx->modems); + g_list_free_full (ctx->modems, (GDestroyNotify) g_object_unref); g_free (ctx->bearer_path); g_free (ctx); } @@ -357,8 +355,7 @@ list_bearers_ready (MMModem *modem, } ctx->bearer = find_bearer_in_list (bearers, ctx->bearer_path); - g_list_foreach (bearers, (GFunc)g_object_unref, NULL); - g_list_free (bearers); + g_list_free_full (bearers, (GDestroyNotify) g_object_unref); /* Found! */ if (ctx->bearer) { @@ -475,8 +472,7 @@ mmcli_get_bearer_sync (GDBusConnection *connection, } found = find_bearer_in_list (bearers, bearer_path); - g_list_foreach (bearers, (GFunc)g_object_unref, NULL); - g_list_free (bearers); + g_list_free_full (bearers, (GDestroyNotify) g_object_unref); if (o_object) *o_object = g_object_ref (object); @@ -484,8 +480,7 @@ mmcli_get_bearer_sync (GDBusConnection *connection, g_object_unref (modem); } - g_list_foreach (modems, (GFunc)g_object_unref, NULL); - g_list_free (modems); + g_list_free_full (modems, (GDestroyNotify) g_object_unref); if (o_manager) *o_manager = manager; @@ -605,8 +600,7 @@ get_sim_manager_ready (GDBusConnection *connection, exit (EXIT_FAILURE); } - g_list_foreach (modems, (GFunc)g_object_unref, NULL); - g_list_free (modems); + g_list_free_full (modems, (GDestroyNotify) g_object_unref); } void @@ -680,8 +674,7 @@ mmcli_get_sim_sync (GDBusConnection *connection, exit (EXIT_FAILURE); } - g_list_foreach (modems, (GFunc)g_object_unref, NULL); - g_list_free (modems); + g_list_free_full (modems, (GDestroyNotify) g_object_unref); if (o_manager) *o_manager = manager; diff --git a/cli/mmcli-manager.c b/cli/mmcli-manager.c index 718a45be..e9d9a93c 100644 --- a/cli/mmcli-manager.c +++ b/cli/mmcli-manager.c @@ -230,8 +230,7 @@ list_current_modems (MMManager *manager) for (l = modems; l; l = g_list_next (l)) { print_modem_short_info (MM_OBJECT (l->data)); } - g_list_foreach (modems, (GFunc)g_object_unref, NULL); - g_list_free (modems); + g_list_free_full (modems, (GDestroyNotify) g_object_unref); } g_print ("\n"); } diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c index d1ef0796..598d1cf2 100644 --- a/cli/mmcli-modem-3gpp.c +++ b/cli/mmcli-modem-3gpp.c @@ -170,8 +170,7 @@ scan_process_reply (GList *result, for (l = result; l; l = g_list_next (l)) { print_network_info ((MMModem3gppNetwork *)(l->data)); } - g_list_foreach (result, (GFunc)mm_modem_3gpp_network_free, NULL); - g_list_free (result); + g_list_free_full (result, (GDestroyNotify) mm_modem_3gpp_network_free); } g_print ("\n"); } |