mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
Use free_full on GList's instead of foreach + free
GList's used in legacy code were free'd using a g_list_foreach + g_list_free, while we can just use g_list_free_full as per GLib 2.28. So replace code where we were using this legacy codepath. https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
This commit is contained in:
parent
9e82f9af25
commit
df7d8e2cbf
@ -1044,10 +1044,8 @@ _cally_actor_clean_action_list (CallyActor *cally_actor)
|
||||
|
||||
if (priv->action_list)
|
||||
{
|
||||
g_list_foreach (priv->action_list,
|
||||
(GFunc) _cally_actor_destroy_action_info,
|
||||
NULL);
|
||||
g_list_free (priv->action_list);
|
||||
g_list_free_full (priv->action_list,
|
||||
(GDestroyNotify) _cally_actor_destroy_action_info);
|
||||
priv->action_list = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -577,8 +577,7 @@ _clutter_meta_group_clear_metas (ClutterMetaGroup *group)
|
||||
{
|
||||
g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL);
|
||||
|
||||
g_list_foreach (group->meta, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (group->meta);
|
||||
g_list_free_full (group->meta, g_object_unref);
|
||||
group->meta = NULL;
|
||||
}
|
||||
|
||||
|
@ -2021,8 +2021,7 @@ add_children (ClutterScript *script,
|
||||
clutter_container_add_actor (container, CLUTTER_ACTOR (object));
|
||||
}
|
||||
|
||||
g_list_foreach (oinfo->children, (GFunc) g_free, NULL);
|
||||
g_list_free (oinfo->children);
|
||||
g_list_free_full (oinfo->children, g_free);
|
||||
|
||||
oinfo->children = unresolved;
|
||||
}
|
||||
|
@ -346,15 +346,12 @@ object_info_free (gpointer data)
|
||||
g_free (oinfo->class_name);
|
||||
g_free (oinfo->type_func);
|
||||
|
||||
g_list_foreach (oinfo->properties, (GFunc) property_info_free, NULL);
|
||||
g_list_free (oinfo->properties);
|
||||
g_list_free_full (oinfo->properties, property_info_free);
|
||||
|
||||
g_list_foreach (oinfo->signals, (GFunc) signal_info_free, NULL);
|
||||
g_list_free (oinfo->signals);
|
||||
g_list_free_full (oinfo->signals, signal_info_free);
|
||||
|
||||
/* these are ids */
|
||||
g_list_foreach (oinfo->children, (GFunc) g_free, NULL);
|
||||
g_list_free (oinfo->children);
|
||||
g_list_free_full (oinfo->children, g_free);
|
||||
|
||||
/* we unref top-level objects and leave the actors alone,
|
||||
* unless we are unmerging in which case we have to destroy
|
||||
|
@ -114,8 +114,7 @@ test_destroy_destroy (ClutterActor *self)
|
||||
test->tex = NULL;
|
||||
}
|
||||
|
||||
g_list_foreach (test->children, (GFunc) clutter_actor_destroy, NULL);
|
||||
g_list_free (test->children);
|
||||
g_list_free_full (test->children, (GDestroyNotify) clutter_actor_destroy);
|
||||
test->children = NULL;
|
||||
|
||||
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
|
||||
|
@ -456,11 +456,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
|
||||
g_slice_free (CoglPipelineBigState, pipeline->big_state);
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
|
||||
{
|
||||
g_list_foreach (pipeline->layer_differences,
|
||||
(GFunc)cogl_object_unref, NULL);
|
||||
g_list_free (pipeline->layer_differences);
|
||||
}
|
||||
g_list_free_full (pipeline->layer_differences, cogl_object_unref);
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_VERTEX_SNIPPETS)
|
||||
_cogl_pipeline_snippet_list_free (&pipeline->big_state->vertex_snippets);
|
||||
@ -937,12 +933,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
|
||||
|
||||
if (dest->differences & COGL_PIPELINE_STATE_LAYERS &&
|
||||
dest->layer_differences)
|
||||
{
|
||||
g_list_foreach (dest->layer_differences,
|
||||
(GFunc)cogl_object_unref,
|
||||
NULL);
|
||||
g_list_free (dest->layer_differences);
|
||||
}
|
||||
g_list_free_full (dest->layer_differences, cogl_object_unref);
|
||||
|
||||
for (l = src->layer_differences; l; l = l->next)
|
||||
{
|
||||
|
@ -851,10 +851,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
void
|
||||
meta_rectangle_free_list_and_elements (GList *filled_list)
|
||||
{
|
||||
g_list_foreach (filled_list,
|
||||
(void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
|
||||
NULL);
|
||||
g_list_free (filled_list);
|
||||
g_list_free_full (filled_list, g_free);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user