core: use g_list_free_full() when possible

This commit is contained in:
Aleksander Morgado
2012-01-05 20:01:05 +01:00
parent a0f7db513f
commit 48d5ac6682
4 changed files with 5 additions and 14 deletions

View File

@@ -135,10 +135,7 @@ mm_bearer_list_delete_all_bearers (MMBearerList *self)
if (!self->priv->bearers) if (!self->priv->bearers)
return; return;
g_list_foreach (self->priv->bearers, g_list_free_full (self->priv->bearers, (GDestroyNotify) g_object_unref);
(GFunc)g_object_unref,
NULL);
g_list_free (self->priv->bearers);
self->priv->bearers = NULL; self->priv->bearers = NULL;
} }

View File

@@ -916,8 +916,7 @@ disconnect_3gpp_bearers_context_complete_and_free (Disconnect3gppBearersContext
if (ctx->current) if (ctx->current)
g_object_unref (ctx->current); g_object_unref (ctx->current);
g_list_foreach (ctx->bearers, (GFunc)g_object_unref, NULL); g_list_free_full (ctx->bearers, (GDestroyNotify) g_object_unref);
g_list_free (ctx->bearers);
g_object_unref (ctx->result); g_object_unref (ctx->result);
g_free (ctx); g_free (ctx);
} }

View File

@@ -442,10 +442,7 @@ disconnection_context_free (DisconnectionContext *ctx)
g_free (ctx->bearer_path); g_free (ctx->bearer_path);
if (ctx->current) if (ctx->current)
g_object_unref (ctx->current); g_object_unref (ctx->current);
if (ctx->bearers) { g_list_free_full (ctx->bearers, (GDestroyNotify) g_object_unref);
g_list_foreach (ctx->bearers, (GFunc)g_object_unref, NULL);
g_list_free (ctx->bearers);
}
g_free (ctx); g_free (ctx);
} }

View File

@@ -57,8 +57,7 @@ mm_3gpp_network_info_free (MM3gppNetworkInfo *info)
void void
mm_3gpp_network_info_list_free (GList *info_list) mm_3gpp_network_info_list_free (GList *info_list)
{ {
g_list_foreach (info_list, (GFunc)mm_3gpp_network_info_free, NULL); g_list_free_full (info_list, (GDestroyNotify) mm_3gpp_network_info_free);
g_list_free (info_list);
} }
static MMModemAccessTechnology static MMModemAccessTechnology
@@ -318,8 +317,7 @@ mm_3gpp_pdp_context_free (MM3gppPdpContext *pdp)
void void
mm_3gpp_pdp_context_list_free (GList *list) mm_3gpp_pdp_context_list_free (GList *list)
{ {
g_list_foreach (list, (GFunc)mm_3gpp_pdp_context_free, NULL); g_list_free_full (list, (GDestroyNotify) mm_3gpp_pdp_context_free);
g_list_free (list);
} }
static gint static gint