Commit 9b450304 authored by Jason Crain's avatar Jason Crain Committed by Albert Astals Cid

glib: Use g_list_free_full

Use g_list_free_full instead of g_list_foreach followed by g_list_free.
This fixes a compiler warning.

The g_list_foreach function takes a "GFunc" callback, which takes two
arguments, but the free functions we pass only take one argument, so the
compiler warns about an incompatible cast. Using g_list_free_full fixes
this because it takes a "GDestroyNotify" callback, which takes one
argument.
parent 1496a00a
......@@ -74,8 +74,7 @@ poppler_action_layer_free (PopplerActionLayer *action_layer)
return;
if (action_layer->layers) {
g_list_foreach (action_layer->layers, (GFunc)g_object_unref, nullptr);
g_list_free (action_layer->layers);
g_list_free_full (action_layer->layers, g_object_unref);
action_layer->layers = nullptr;
}
......@@ -136,8 +135,7 @@ poppler_action_free (PopplerAction *action)
break;
case POPPLER_ACTION_OCG_STATE:
if (action->ocg_state.state_list) {
g_list_foreach (action->ocg_state.state_list, (GFunc)poppler_action_layer_free, nullptr);
g_list_free (action->ocg_state.state_list);
g_list_free_full (action->ocg_state.state_list, (GDestroyNotify)poppler_action_layer_free);
}
break;
case POPPLER_ACTION_JAVASCRIPT:
......
......@@ -3127,8 +3127,7 @@ layer_free (Layer *layer)
return;
if (layer->kids) {
g_list_foreach (layer->kids, (GFunc)layer_free, nullptr);
g_list_free (layer->kids);
g_list_free_full (layer->kids, (GDestroyNotify)layer_free);
}
if (layer->label) {
......@@ -3276,11 +3275,8 @@ poppler_document_layers_free (PopplerDocument *document)
if (G_UNLIKELY (!document->layers))
return;
g_list_foreach (document->layers, (GFunc)layer_free, nullptr);
g_list_free (document->layers);
g_list_foreach (document->layers_rbgroups, (GFunc)g_list_free, nullptr);
g_list_free (document->layers_rbgroups);
g_list_free_full (document->layers, (GDestroyNotify)layer_free);
g_list_free_full (document->layers_rbgroups, (GDestroyNotify)g_list_free);
document->layers = nullptr;
document->layers_rbgroups = nullptr;
......
......@@ -729,8 +729,7 @@ poppler_page_selection_region_free (GList *region)
if (G_UNLIKELY (!region))
return;
g_list_foreach (region, (GFunc)poppler_rectangle_free, nullptr);
g_list_free (region);
g_list_free_full (region, (GDestroyNotify)poppler_rectangle_free);
}
/**
......@@ -1117,8 +1116,7 @@ poppler_page_free_image_mapping (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
g_list_foreach (list, (GFunc)poppler_image_mapping_free, nullptr);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify)poppler_image_mapping_free);
}
/**
......@@ -1301,8 +1299,7 @@ poppler_page_free_link_mapping (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
g_list_foreach (list, (GFunc)poppler_link_mapping_free, nullptr);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify)poppler_link_mapping_free);
}
/**
......@@ -1368,8 +1365,7 @@ poppler_page_free_form_field_mapping (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, nullptr);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify)poppler_form_field_mapping_free);
}
/**
......@@ -1505,8 +1501,7 @@ poppler_page_free_annot_mapping (GList *list)
if (G_UNLIKELY (!list))
return;
g_list_foreach (list, (GFunc)poppler_annot_mapping_free, nullptr);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify)poppler_annot_mapping_free);
}
/**
......@@ -2306,8 +2301,7 @@ poppler_page_free_text_attributes (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
g_list_foreach (list, (GFunc)poppler_text_attributes_free, nullptr);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify)poppler_text_attributes_free);
}
static gboolean
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment