g_free (metadata->mime_type);
- if (metadata->groups)
- {
- g_list_foreach (metadata->groups,
- (GFunc) g_free,
- NULL);
- g_list_free (metadata->groups);
- }
-
- if (metadata->applications)
- {
- g_list_foreach (metadata->applications,
- (GFunc) bookmark_app_info_free,
- NULL);
- g_list_free (metadata->applications);
- }
+ g_list_free_full (metadata->groups, g_free);
+ g_list_free_full (metadata->applications, (GDestroyNotify) bookmark_app_info_free);
g_hash_table_destroy (metadata->apps_by_name);
g_free (bookmark->title);
g_free (bookmark->description);
- if (bookmark->items)
- {
- g_list_foreach (bookmark->items,
- (GFunc) bookmark_item_free,
- NULL);
- g_list_free (bookmark->items);
-
- bookmark->items = NULL;
- }
+ g_list_free_full (bookmark->items, (GDestroyNotify) bookmark_item_free);
+ bookmark->items = NULL;
if (bookmark->items_by_uri)
{
if (!item->metadata)
item->metadata = bookmark_metadata_new ();
- if (item->metadata->groups != NULL)
- {
- g_list_foreach (item->metadata->groups,
- (GFunc) g_free,
- NULL);
- g_list_free (item->metadata->groups);
- item->metadata->groups = NULL;
- }
+ g_list_free_full (item->metadata->groups, g_free);
+ item->metadata->groups = NULL;
if (groups)
{
/* Note all keys must be comments at the top of
* the file, so we can just free it all.
*/
- if (group->key_value_pairs != NULL)
- {
- g_list_foreach (group->key_value_pairs,
- (GFunc) g_key_file_key_value_pair_free,
- NULL);
- g_list_free (group->key_value_pairs);
- group->key_value_pairs = NULL;
- }
+ g_list_free_full (group->key_value_pairs, (GDestroyNotify) g_key_file_key_value_pair_free);
+ group->key_value_pairs = NULL;
if (comment == NULL)
return TRUE;
{
g_return_if_fail (context != NULL);
- g_list_foreach (context->groups, (GFunc)g_option_group_free, NULL);
- g_list_free (context->groups);
+ g_list_free_full (context->groups, (GDestroyNotify) g_option_group_free);
if (context->main_group)
g_option_group_free (context->main_group);
result = g_string_sized_new (strlen (string_to_expand));
interpolate_replacement (match_info, result, list);
- g_list_foreach (list, (GFunc)free_interpolation_data, NULL);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify) free_interpolation_data);
return g_string_free (result, FALSE);
}
if (tmp_error != NULL)
{
g_propagate_error (error, tmp_error);
- g_list_foreach (list, (GFunc)g_free, NULL);
- g_list_free (list);
+ g_list_free_full (list, g_free);
match_info->pos = -1;
return NULL;
}
start = p = expand_escape (replacement, p, data, error);
if (p == NULL)
{
- g_list_foreach (list, (GFunc)free_interpolation_data, NULL);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify) free_interpolation_data);
free_interpolation_data (data);
return NULL;
if (tmp_error != NULL)
g_propagate_error (error, tmp_error);
- g_list_foreach (list, (GFunc)free_interpolation_data, NULL);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify) free_interpolation_data);
return result;
}
if (has_references)
*has_references = interpolation_list_needs_match (list);
- g_list_foreach (list, (GFunc) free_interpolation_data, NULL);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify) free_interpolation_data);
return TRUE;
}