cli: use g_list_free_full() when possible
This commit is contained in:
+7
-14
@@ -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;
|
||||
|
||||
+1
-2
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user