* Gets a list of strings containing all the registered content types
* known to the system. The list and its data should be freed using
* <programlisting>
- * g_list_foreach (list, g_free, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_free);
* </programlisting>
*
* Returns: (element-type utf8) (transfer full): #GList of the registered content types
static void
tree_matchlet_free (TreeMatchlet *matchlet)
{
- g_list_foreach (matchlet->matches, (GFunc)tree_matchlet_free, NULL);
- g_list_free (matchlet->matches);
+ g_list_free_full (matchlet->matches, (GDestroyNotify) tree_matchlet_free);
g_free (matchlet->path);
g_free (matchlet->mimetype);
g_slice_free (TreeMatchlet, matchlet);
static void
tree_match_free (TreeMatch *match)
{
- g_list_foreach (match->matches, (GFunc)tree_matchlet_free, NULL);
- g_list_free (match->matches);
+ g_list_free_full (match->matches, (GDestroyNotify) tree_matchlet_free);
g_free (match->contenttype);
g_slice_free (TreeMatch, match);
}
static void
tree_magic_shutdown (void)
{
- g_list_foreach (tree_matches, (GFunc)tree_match_free, NULL);
- g_list_free (tree_matches);
+ g_list_free_full (tree_matches, (GDestroyNotify) tree_match_free);
tree_matches = NULL;
}
if (auth->priv->stream != NULL)
g_object_unref (auth->priv->stream);
- g_list_foreach (auth->priv->available_mechanisms, (GFunc) mechanism_free, NULL);
- g_list_free (auth->priv->available_mechanisms);
+ g_list_free_full (auth->priv->available_mechanisms, (GDestroyNotify) mechanism_free);
if (G_OBJECT_CLASS (_g_dbus_auth_parent_class)->finalize != NULL)
G_OBJECT_CLASS (_g_dbus_auth_parent_class)->finalize (object);
GDBusObjectProxy *object_proxy = G_DBUS_OBJECT_PROXY (l->data);
g_signal_emit_by_name (manager, "object-removed", object_proxy);
}
- g_list_foreach (proxies, (GFunc) g_object_unref, NULL);
- g_list_free (proxies);
+ g_list_free_full (proxies, g_object_unref);
/* nuke local filter */
maybe_unsubscribe_signals (manager);
interfaces = g_dbus_object_get_interfaces (G_DBUS_OBJECT (op));
num_interfaces = g_list_length (interfaces);
- g_list_foreach (interfaces, (GFunc) g_object_unref, NULL);
- g_list_free (interfaces);
+ g_list_free_full (interfaces, g_object_unref);
num_interfaces_to_remove = g_strv_length ((gchar **) interface_names);
registration_data_export_interface (data, interface_skeleton, object_path);
g_ptr_array_add (interface_names, g_dbus_interface_skeleton_get_info (interface_skeleton)->name);
}
- g_list_foreach (existing_interfaces, (GFunc) g_object_unref, NULL);
- g_list_free (existing_interfaces);
+ g_list_free_full (existing_interfaces, g_object_unref);
g_ptr_array_add (interface_names, NULL);
data->exported = TRUE;
for (l = to_flush; l != NULL; l = l->next)
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (l->data));
- g_list_foreach (to_flush, (GFunc) g_object_unref, NULL);
- g_list_free (to_flush);
+ g_list_free_full (to_flush, g_object_unref);
}
static void
ret = TRUE;
out:
- g_list_foreach (resolved_addresses, (GFunc) g_object_unref, NULL);
- g_list_free (resolved_addresses);
+ g_list_free_full (resolved_addresses, g_object_unref);
g_object_unref (resolver);
return ret;
}
envp = g_environ_setenv (envp, "DESKTOP_STARTUP_ID", sn_id, TRUE);
}
- g_list_foreach (launched_files, (GFunc)g_object_unref, NULL);
- g_list_free (launched_files);
+ g_list_free_full (launched_files, g_object_unref);
}
if (!g_spawn_async (info->path,
res = g_desktop_app_info_launch_uris (appinfo, uris, launch_context, error);
- g_list_foreach (uris, (GFunc)g_free, NULL);
- g_list_free (uris);
+ g_list_free_full (uris, g_free);
return res;
}
GList *value,
gpointer data)
{
- g_list_foreach (value, (GFunc)g_free, NULL);
- g_list_free (value);
+ g_list_free_full (value, g_free);
}
static void
if (cache == NULL)
return;
- g_list_foreach (cache->dirs,
- (GFunc) mime_info_cache_dir_free,
- NULL);
- g_list_free (cache->dirs);
+ g_list_free_full (cache->dirs, (GDestroyNotify) mime_info_cache_dir_free);
g_hash_table_destroy (cache->global_defaults_cache);
g_free (cache);
}
else
g_free (default_entry);
- g_list_foreach (removed_entries, (GFunc)g_free, NULL);
- g_list_free (removed_entries);
+ g_list_free_full (removed_entries, g_free);
desktop_entries = g_list_reverse (desktop_entries);
emblemed = G_EMBLEMED_ICON (object);
g_object_unref (emblemed->priv->icon);
- g_list_foreach (emblemed->priv->emblems, (GFunc) g_object_unref, NULL);
- g_list_free (emblemed->priv->emblems);
+ g_list_free_full (emblemed->priv->emblems, g_object_unref);
(*G_OBJECT_CLASS (g_emblemed_icon_parent_class)->finalize) (object);
}
next_async_op_free (NextAsyncOp *op)
{
/* Free the list, if finish wasn't called */
- g_list_foreach (op->files, (GFunc)g_object_unref, NULL);
- g_list_free (op->files);
+ g_list_free_full (op->files, g_object_unref);
g_free (op);
}
if (completer->basenames_dir)
g_object_unref (completer->basenames_dir);
- g_list_foreach (completer->basenames, (GFunc)g_free, NULL);
- g_list_free (completer->basenames);
+ g_list_free_full (completer->basenames, g_free);
G_OBJECT_CLASS (g_filename_completer_parent_class)->finalize (object);
}
g_object_unref (data->cancellable);
g_object_unref (data->dir);
- g_list_foreach (data->basenames, (GFunc)g_free, NULL);
- g_list_free (data->basenames);
+ g_list_free_full (data->basenames, g_free);
g_free (data);
}
if (data->completer->basenames_dir)
g_object_unref (data->completer->basenames_dir);
- g_list_foreach (data->completer->basenames, (GFunc)g_free, NULL);
- g_list_free (data->completer->basenames);
+ g_list_free_full (data->completer->basenames, g_free);
data->completer->basenames_dir = g_object_ref (data->dir);
data->completer->basenames = data->basenames;
if (data->completer->basenames_dir)
g_object_unref (data->completer->basenames_dir);
- g_list_foreach (data->completer->basenames, (GFunc)g_free, NULL);
- g_list_free (data->completer->basenames);
+ g_list_free_full (data->completer->basenames, g_free);
/* Mark uptodate with no basenames */
data->completer->basenames_dir = g_object_ref (data->dir);
g_object_unref (monitor->mount_monitor);
- g_list_foreach (monitor->last_mountpoints, (GFunc)g_unix_mount_point_free, NULL);
- g_list_free (monitor->last_mountpoints);
- g_list_foreach (monitor->last_mounts, (GFunc)g_unix_mount_free, NULL);
- g_list_free (monitor->last_mounts);
+ g_list_free_full (monitor->last_mountpoints, (GDestroyNotify) g_unix_mount_point_free);
+ g_list_free_full (monitor->last_mounts, (GDestroyNotify) g_unix_mount_free);
- g_list_foreach (monitor->volumes, (GFunc)g_object_unref, NULL);
- g_list_free (monitor->volumes);
- g_list_foreach (monitor->mounts, (GFunc)g_object_unref, NULL);
- g_list_free (monitor->mounts);
+ g_list_free_full (monitor->volumes, g_object_unref);
+ g_list_free_full (monitor->mounts, g_object_unref);
G_OBJECT_CLASS (g_unix_volume_monitor_parent_class)->finalize (object);
}
GUnixVolumeMonitor *monitor;
monitor = G_UNIX_VOLUME_MONITOR (object);
- g_list_foreach (monitor->volumes, (GFunc)g_object_unref, NULL);
- g_list_free (monitor->volumes);
+
+ g_list_free_full (monitor->volumes, g_object_unref);
monitor->volumes = NULL;
- g_list_foreach (monitor->mounts, (GFunc)g_object_unref, NULL);
- g_list_free (monitor->mounts);
+ g_list_free_full (monitor->mounts, g_object_unref);
monitor->mounts = NULL;
G_OBJECT_CLASS (g_unix_volume_monitor_parent_class)->dispose (object);
g_list_free (added);
g_list_free (removed);
- g_list_foreach (monitor->last_mountpoints,
- (GFunc)g_unix_mount_point_free, NULL);
- g_list_free (monitor->last_mountpoints);
+ g_list_free_full (monitor->last_mountpoints, (GDestroyNotify) g_unix_mount_point_free);
monitor->last_mountpoints = new_mountpoints;
}
g_list_free (added);
g_list_free (removed);
- g_list_foreach (monitor->last_mounts,
- (GFunc)g_unix_mount_free, NULL);
- g_list_free (monitor->last_mounts);
+ g_list_free_full (monitor->last_mounts, (GDestroyNotify) g_unix_mount_free);
monitor->last_mounts = new_mounts;
}