summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-11-23 11:18:34 +0200
committerJasmine Hassan <[email protected]>2012-11-23 11:18:34 +0200
commitb00cccb74307a49df74deb785936e3cd9cf3a5ad (patch)
treef2bcc459a2bef12678e642d0a14ce7f02373b71d /libcaja-private
parentb12a7f6ea3309ecddfc7e3ae839a7b558c862533 (diff)
downloadcaja-b00cccb74307a49df74deb785936e3cd9cf3a5ad.tar.bz2
caja-b00cccb74307a49df74deb785936e3cd9cf3a5ad.tar.xz
[all] include src/glibcompat.h & use g_list_free_full() where needed
Also fixes a double-free regression in lc-p/caja-query from 7a42b9b0
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-autorun.c5
-rw-r--r--libcaja-private/caja-clipboard.c5
-rw-r--r--libcaja-private/caja-customization-data.c8
-rw-r--r--libcaja-private/caja-debug-log.c5
-rw-r--r--libcaja-private/caja-directory-async.c23
-rw-r--r--libcaja-private/caja-directory.c23
-rw-r--r--libcaja-private/caja-dnd.c9
-rw-r--r--libcaja-private/caja-emblem-utils.c5
-rw-r--r--libcaja-private/caja-file-changes-queue.c17
-rw-r--r--libcaja-private/caja-file-dnd.c5
-rw-r--r--libcaja-private/caja-file-operations.c26
-rw-r--r--libcaja-private/caja-file-utilities.c5
-rw-r--r--libcaja-private/caja-file.c29
-rw-r--r--libcaja-private/caja-icon-canvas-item.c8
-rw-r--r--libcaja-private/caja-icon-container.c5
-rw-r--r--libcaja-private/caja-merged-directory.c5
-rw-r--r--libcaja-private/caja-mime-actions.c11
-rw-r--r--libcaja-private/caja-mime-application-chooser.c5
-rw-r--r--libcaja-private/caja-open-with-dialog.c5
-rw-r--r--libcaja-private/caja-program-choosing.c14
-rw-r--r--libcaja-private/caja-query.c7
-rw-r--r--libcaja-private/caja-search-engine-beagle.c5
-rw-r--r--libcaja-private/caja-search-engine-simple.c11
-rw-r--r--libcaja-private/caja-search-engine-tracker.c7
-rw-r--r--libcaja-private/caja-undostack-manager.c32
25 files changed, 125 insertions, 155 deletions
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index 66534642..2896cb9d 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -43,6 +43,8 @@
#include "caja-desktop-icon-file.h"
#include "caja-file-utilities.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
enum
{
AUTORUN_ASK,
@@ -651,8 +653,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
{
g_object_unref (default_app_info);
}
- g_list_foreach (app_info_list, (GFunc) g_object_unref, NULL);
- g_list_free(app_info_list);
+ g_list_free_full (app_info_list, g_object_unref);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store));
g_object_unref (G_OBJECT (list_store));
diff --git a/libcaja-private/caja-clipboard.c b/libcaja-private/caja-clipboard.c
index bce5d552..2cc61f7a 100644
--- a/libcaja-private/caja-clipboard.c
+++ b/libcaja-private/caja-clipboard.c
@@ -35,6 +35,8 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef struct _TargetCallbackData TargetCallbackData;
typedef void (* SelectAllCallback) (gpointer target);
@@ -681,7 +683,6 @@ caja_clipboard_clear_if_colliding_uris (GtkWidget *widget,
}
if (clipboard_item_uris) {
- g_list_foreach (clipboard_item_uris, (GFunc) g_free, NULL);
- g_list_free(clipboard_item_uris);
+ g_list_free_full (clipboard_item_uris, g_free);
}
}
diff --git a/libcaja-private/caja-customization-data.c b/libcaja-private/caja-customization-data.c
index 01521d0a..a1019301 100644
--- a/libcaja-private/caja-customization-data.c
+++ b/libcaja-private/caja-customization-data.c
@@ -43,6 +43,8 @@
#include <stdlib.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef enum
{
READ_PUBLIC_CUSTOMIZATIONS,
@@ -304,10 +306,8 @@ caja_customization_data_destroy (CajaCustomizationData *data)
g_object_unref (data->pattern_frame);
}
- g_list_foreach(data->public_file_list, (GFunc) g_object_unref, NULL);
- g_list_free(data->public_file_list);
- g_list_foreach(data->private_file_list, (GFunc) g_object_unref, NULL);
- g_list_free(data->private_file_list);
+ g_list_free_full (data->public_file_list, g_object_unref);
+ g_list_free_full (data->private_file_list, g_object_unref);
if (data->name_map_hash != NULL)
{
diff --git a/libcaja-private/caja-debug-log.c b/libcaja-private/caja-debug-log.c
index 1ccfed0b..4b18ca80 100644
--- a/libcaja-private/caja-debug-log.c
+++ b/libcaja-private/caja-debug-log.c
@@ -30,6 +30,8 @@
#include "caja-debug-log.h"
#include "caja-file.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define DEFAULT_RING_BUFFER_NUM_LINES 1000
#define KEY_FILE_GROUP "debug log"
@@ -308,8 +310,7 @@ caja_debug_log_with_file_list (gboolean is_milestone, const char *domain, GList
caja_debug_logv (is_milestone, domain, uris, format, args);
va_end (args);
- g_list_foreach (uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
}
gboolean
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c
index 9694b1b0..91a2ffb4 100644
--- a/libcaja-private/caja-directory-async.c
+++ b/libcaja-private/caja-directory-async.c
@@ -39,6 +39,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* turn this on to see messages about each load_directory call: */
#if 0
#define DEBUG_LOAD_DIRECTORY
@@ -1079,8 +1081,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
file->details->got_mime_list = TRUE;
file->details->mime_list_is_up_to_date = TRUE;
- g_list_foreach (file->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(file->details->mime_list);
+ g_list_free_full (file->details->mime_list, g_free);
file->details->mime_list = istr_set_get_as_list
(dir_load_state->load_mime_list_hash);
@@ -1093,8 +1094,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
}
drain:
- g_list_foreach (pending_file_info, (GFunc) g_object_unref, NULL);
- g_list_free(pending_file_info);
+ g_list_free_full (pending_file_info, g_object_unref);
/* Get the state machine running again. */
caja_directory_async_state_changed (directory);
@@ -1182,8 +1182,7 @@ file_list_cancel (CajaDirectory *directory)
if (directory->details->pending_file_info != NULL)
{
- g_list_foreach (directory->details->pending_file_info, (GFunc) g_object_unref, NULL);
- g_list_free(directory->details->pending_file_info);
+ g_list_free_full (directory->details->pending_file_info, g_object_unref);
directory->details->pending_file_info = NULL;
}
@@ -2788,8 +2787,7 @@ count_more_files_callback (GObject *source_object,
state);
}
- g_list_foreach (files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
if (error)
{
@@ -3014,8 +3012,7 @@ deep_count_state_free (DeepCountState *state)
{
g_object_unref (state->deep_count_location);
}
- g_list_foreach (state->deep_count_subdirectories, (GFunc) g_object_unref, NULL);
- g_list_free(state->deep_count_subdirectories);
+ g_list_free_full (state->deep_count_subdirectories, g_object_unref);
g_array_free (state->seen_deep_count_inodes, TRUE);
g_free (state);
}
@@ -3323,8 +3320,7 @@ mime_list_done (MimeListState *state, gboolean success)
file = state->mime_list_file;
file->details->mime_list_is_up_to_date = TRUE;
- g_list_foreach(file->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(file->details->mime_list);
+ g_list_free_full (file->details->mime_list, g_free);
if (success)
{
file->details->mime_list_failed = TRUE;
@@ -4579,8 +4575,7 @@ get_mount_at (GFile *target)
g_object_unref (root);
}
- g_list_foreach (mounts, (GFunc) g_object_unref, NULL);
- g_list_free(mounts);
+ g_list_free_full (mounts, g_object_unref);
g_object_unref (monitor);
diff --git a/libcaja-private/caja-directory.c b/libcaja-private/caja-directory.c
index 38d73794..50462916 100644
--- a/libcaja-private/caja-directory.c
+++ b/libcaja-private/caja-directory.c
@@ -40,6 +40,8 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
enum
{
FILES_ADDED,
@@ -175,8 +177,7 @@ caja_directory_finalize (GObject *object)
if (directory->details->monitor_list != NULL)
{
g_warning ("destroying a CajaDirectory while it's being monitored");
- g_list_foreach(directory->details->monitor_list, (GFunc) g_free, NULL);
- g_list_free(directory->details->monitor_list);
+ g_list_free_full (directory->details->monitor_list, g_free);
}
if (directory->details->monitor != NULL)
@@ -213,8 +214,7 @@ caja_directory_finalize (GObject *object)
g_assert (directory->details->directory_load_in_progress == NULL);
g_assert (directory->details->count_in_progress == NULL);
g_assert (directory->details->dequeue_pending_idle_id == 0);
- g_list_foreach(directory->details->pending_file_info, (GFunc) g_object_unref, NULL);
- g_list_free(directory->details->pending_file_info);
+ g_list_free_full (directory->details->pending_file_info, g_object_unref);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
@@ -941,8 +941,7 @@ call_get_file_info_free_list (gpointer key, gpointer value, gpointer user_data)
files = value;
caja_directory_get_info_for_new_files (directory, files);
- g_list_foreach (files, (GFunc) g_object_unref, NULL);
- g_list_free (files);
+ g_list_free_full (files, g_object_unref);
}
static void
@@ -1094,8 +1093,7 @@ caja_directory_notify_files_added_by_uri (GList *uris)
files = caja_file_list_from_uris (uris);
caja_directory_notify_files_added (files);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
void
@@ -1144,8 +1142,7 @@ caja_directory_notify_files_changed_by_uri (GList *uris)
files = caja_file_list_from_uris (uris);
caja_directory_notify_files_changed (files);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
void
@@ -1206,8 +1203,7 @@ caja_directory_notify_files_removed_by_uri (GList *uris)
files = caja_file_list_from_uris (uris);
caja_directory_notify_files_changed (files);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
static void
@@ -1500,8 +1496,7 @@ caja_directory_notify_files_moved_by_uri (GList *uri_pairs)
file_pairs = uri_pairs_to_file_pairs (uri_pairs);
caja_directory_notify_files_moved (file_pairs);
- g_list_foreach (file_pairs, (GFunc)g_file_pair_free, NULL);
- g_list_free (file_pairs);
+ g_list_free_full (file_pairs, g_file_pair_free);
}
void
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c
index feea5ca8..5943f041 100644
--- a/libcaja-private/caja-dnd.c
+++ b/libcaja-private/caja-dnd.c
@@ -44,6 +44,8 @@
#include <stdio.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* a set of defines stolen from the eel-icon-dnd.c file.
* These are in microseconds.
*/
@@ -129,8 +131,7 @@ caja_drag_uri_array_from_selection_list (const GList *selection_list)
uri_list = caja_drag_uri_list_from_selection_list (selection_list);
uris = caja_drag_uri_array_from_list (uri_list);
- g_list_foreach(uri_list, (GFunc) g_free, NULL);
- g_list_free(uri_list);
+ g_list_free_full (uri_list, g_free);
return uris;
}
@@ -1316,9 +1317,7 @@ slot_proxy_handle_drop (GtkWidget *widget,
uri_list,
target_uri,
gdk_drag_context_get_selected_action (context));
- g_list_foreach(uri_list, (GFunc) g_free, NULL);
- g_list_free(uri_list);
-
+ g_list_free_full (uri_list, g_free);
}
else if (drag_info->info == CAJA_ICON_DND_URI_LIST)
{
diff --git a/libcaja-private/caja-emblem-utils.c b/libcaja-private/caja-emblem-utils.c
index dd70dbc3..f837df69 100644
--- a/libcaja-private/caja-emblem-utils.c
+++ b/libcaja-private/caja-emblem-utils.c
@@ -43,6 +43,8 @@
#include "caja-file.h"
#include "caja-emblem-utils.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define EMBLEM_NAME_TRASH "emblem-trash"
#define EMBLEM_NAME_SYMLINK "emblem-symbolic-link"
#define EMBLEM_NAME_NOREAD "emblem-noread"
@@ -119,8 +121,7 @@ is_reserved_keyword (const char *keyword)
result = g_list_find_custom (available,
(char *) icon_name,
(GCompareFunc) g_ascii_strcasecmp) != NULL;
- g_list_foreach(available, (GFunc) g_free, NULL);
- g_list_free(available);
+ g_list_free_full (available, g_free);
g_free (icon_name);
return result;
}
diff --git a/libcaja-private/caja-file-changes-queue.c b/libcaja-private/caja-file-changes-queue.c
index 39cf123e..43495c93 100644
--- a/libcaja-private/caja-file-changes-queue.c
+++ b/libcaja-private/caja-file-changes-queue.c
@@ -25,6 +25,8 @@
#include "caja-directory-notify.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#ifdef G_THREADS_ENABLED
#define MUTEX_LOCK(a) if ((a) != NULL) g_mutex_lock (a)
#define MUTEX_UNLOCK(a) if ((a) != NULL) g_mutex_unlock (a)
@@ -288,8 +290,7 @@ pairs_list_free (GList *pairs)
}
/* delete the list and the now empty pair structs */
- g_list_foreach(pairs, (GFunc) g_free, NULL);
- g_list_free(pairs);
+ g_list_free_full (pairs, g_free);
}
static void
@@ -304,8 +305,7 @@ position_set_list_free (GList *list)
g_object_unref (item->location);
}
/* delete the list and the now empty structs */
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
+ g_list_free_full (list, g_free);
}
/* go through changes in the change queue, send ones with the same kind
@@ -387,8 +387,7 @@ caja_file_changes_consume_changes (gboolean consume_all)
{
deletions = g_list_reverse (deletions);
caja_directory_notify_files_removed (deletions);
- g_list_foreach(deletions, (GFunc) g_object_unref, NULL);
- g_list_free(deletions);
+ g_list_free_full (deletions, g_object_unref);
deletions = NULL;
}
if (moves != NULL)
@@ -402,16 +401,14 @@ caja_file_changes_consume_changes (gboolean consume_all)
{
additions = g_list_reverse (additions);
caja_directory_notify_files_added (additions);
- g_list_foreach(additions, (GFunc) g_object_unref, NULL);
- g_list_free(additions);
+ g_list_free_full (additions, g_object_unref);
additions = NULL;
}
if (changes != NULL)
{
changes = g_list_reverse (changes);
caja_directory_notify_files_changed (changes);
- g_list_foreach(changes, (GFunc) g_object_unref, NULL);
- g_list_free(changes);
+ g_list_free_full (changes, g_object_unref);
changes = NULL;
}
if (position_set_requests != NULL)
diff --git a/libcaja-private/caja-file-dnd.c b/libcaja-private/caja-file-dnd.c
index 2c239643..5e1beec5 100644
--- a/libcaja-private/caja-file-dnd.c
+++ b/libcaja-private/caja-file-dnd.c
@@ -32,6 +32,8 @@
#include "caja-file-utilities.h"
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
static gboolean
caja_drag_can_accept_files (CajaFile *drop_target_item)
{
@@ -181,6 +183,5 @@ caja_drag_file_receive_dropped_keyword (CajaFile *file,
}
caja_file_set_keywords (file, keywords);
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
}
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 067f52d5..baaa8843 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -68,6 +68,8 @@
#include "caja-file-conflict-dialog.h"
#include "caja-undostack-manager.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* TODO: TESTING!!! */
typedef struct {
@@ -1858,8 +1860,7 @@ delete_job_done (gpointer user_data)
job = user_data;
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
if (job->done_callback) {
debuting_uris = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, NULL);
@@ -2188,8 +2189,7 @@ has_trash_files (GMount *mount)
}
}
- g_list_foreach(dirs, (GFunc) g_object_unref, NULL);
- g_list_free(dirs);
+ g_list_free_full (dirs, g_object_unref);
return res;
}
@@ -4462,8 +4462,7 @@ copy_job_done (gpointer user_data)
job->done_callback (job->debuting_files, job->done_callback_data);
}
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
if (job->destination) {
g_object_unref (job->destination);
}
@@ -4990,8 +4989,7 @@ move_job_done (gpointer user_data)
job->done_callback (job->debuting_files, job->done_callback_data);
}
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
g_object_unref (job->destination);
g_hash_table_unref (job->debuting_files);
g_free (job->icon_positions);
@@ -5071,8 +5069,7 @@ move_job (GIOSchedulerJob *io_job,
&source_info, &transfer_info);
aborted:
- g_list_foreach(fallbacks, (GFunc) g_free, NULL);
- g_list_free(fallbacks);
+ g_list_free_full (fallbacks, g_free);
g_free (dest_fs_id);
g_free (dest_fs_type);
@@ -5326,8 +5323,7 @@ link_job_done (gpointer user_data)
job->done_callback (job->debuting_files, job->done_callback_data);
}
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
g_object_unref (job->destination);
g_hash_table_unref (job->debuting_files);
g_free (job->icon_positions);
@@ -5779,8 +5775,7 @@ caja_file_operations_copy_move (const GList *item_uris,
done_callback, done_callback_data);
}
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
if (dest) {
g_object_unref (dest);
}
@@ -6258,8 +6253,7 @@ empty_trash_job_done (gpointer user_data)
job = user_data;
- g_list_foreach(job->trash_dirs, (GFunc) g_object_unref, NULL);
- g_list_free(job->trash_dirs);
+ g_list_free_full (job->trash_dirs, g_object_unref);
if (job->done_callback) {
job->done_callback (job->done_callback_data);
diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c
index bfe8321e..51ecbf5b 100644
--- a/libcaja-private/caja-file-utilities.c
+++ b/libcaja-private/caja-file-utilities.c
@@ -43,6 +43,8 @@
#include <unistd.h>
#include <stdlib.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define CAJA_USER_DIRECTORY_NAME ".config/caja"
#define DEFAULT_CAJA_DIRECTORY_MODE (0755)
@@ -1428,8 +1430,7 @@ caja_restore_files_from_trash (GList *files,
parent_window,
NULL, NULL);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
g_object_unref (original_dir_location);
}
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 788eec68..1958fafc 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -70,6 +70,8 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#endif
@@ -816,14 +818,10 @@ finalize (GObject *object)
eel_ref_str_unref (file->details->filesystem_id);
- g_list_foreach(file->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(file->details->mime_list);
- g_list_foreach(file->details->pending_extension_emblems, (GFunc) g_free, NULL);
- g_list_free(file->details->pending_extension_emblems);
- g_list_foreach(file->details->extension_emblems, (GFunc) g_free, NULL);
- g_list_free(file->details->extension_emblems);
- g_list_foreach(file->details->pending_info_providers, (GFunc) g_object_unref, NULL);
- g_list_free(file->details->pending_info_providers);
+ g_list_free_full (file->details->mime_list, g_free);
+ g_list_free_full (file->details->pending_extension_emblems, g_free);
+ g_list_free_full (file->details->extension_emblems, g_free);
+ g_list_free_full (file->details->pending_info_providers, g_object_unref);
if (file->details->pending_extension_attributes) {
g_hash_table_destroy (file->details->pending_extension_attributes);
@@ -2997,8 +2995,7 @@ fill_emblem_cache_if_needed (CajaFile *file)
/* Zero-terminate so we can tell where the list ends. */
*scanner = 0;
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
}
static int
@@ -6605,8 +6602,7 @@ caja_file_get_emblem_icons (CajaFile *file,
icons = g_list_prepend (icons, icon);
}
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
return icons;
}
@@ -6665,8 +6661,7 @@ sort_keyword_list_and_remove_duplicates (GList *keywords)
if (strcmp ((const char *) p->data, (const char *) p->next->data) == 0) {
duplicate_link = p->next;
keywords = g_list_remove_link (keywords, duplicate_link);
- g_list_foreach(duplicate_link, (GFunc) g_free, NULL);
- g_list_free(duplicate_link);
+ g_list_free_full (duplicate_link, g_free);
} else {
p = p->next;
}
@@ -7560,8 +7555,7 @@ void
caja_file_invalidate_extension_info_internal (CajaFile *file)
{
if (file->details->pending_info_providers)
- g_list_foreach(file->details->pending_info_providers, (GFunc) g_object_unref, NULL);
- g_list_free(file->details->pending_info_providers);
+ g_list_free_full (file->details->pending_info_providers, g_object_unref);
file->details->pending_info_providers =
caja_module_get_extensions_for_type (CAJA_TYPE_INFO_PROVIDER);
@@ -8383,8 +8377,7 @@ caja_file_invalidate_extension_info (CajaFile *file)
void
caja_file_info_providers_done (CajaFile *file)
{
- g_list_foreach(file->details->extension_emblems, (GFunc) g_free, NULL);
- g_list_free(file->details->extension_emblems);
+ g_list_free_full (file->details->extension_emblems, g_free);
file->details->extension_emblems = file->details->pending_extension_emblems;
file->details->pending_extension_emblems = NULL;
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 45e6f98b..b8e3fa28 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -50,6 +50,8 @@
#include <stdio.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define EMBLEM_SPACING 2
/* gap between bottom of icon and start of text box */
@@ -326,8 +328,7 @@ caja_icon_canvas_item_finalize (GObject *object)
g_object_unref (details->text_util);
}
- g_list_foreach(details->emblem_pixbufs, (GFunc) g_object_unref, NULL);
- g_list_free(details->emblem_pixbufs);
+ g_list_free_full (details->emblem_pixbufs, g_object_unref);
g_free (details->editable_text);
g_free (details->additional_text);
g_free (details->attach_points);
@@ -763,8 +764,7 @@ caja_icon_canvas_item_set_emblems (CajaIconCanvasItem *item,
/* Take in the new list of emblems. */
eel_g_object_list_ref (emblem_pixbufs);
- g_list_foreach(item->details->emblem_pixbufs, (GFunc) g_object_unref, NULL);
- g_list_free(item->details->emblem_pixbufs);
+ g_list_free_full (item->details->emblem_pixbufs, g_object_unref);
item->details->emblem_pixbufs = g_list_copy (emblem_pixbufs);
caja_icon_canvas_item_invalidate_bounds_cache (item);
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 2b38220c..10f5fc8f 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -52,6 +52,8 @@
#include <stdio.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#if !GTK_CHECK_VERSION(3, 0, 0)
#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
@@ -7793,8 +7795,7 @@ caja_icon_container_update_icon (CajaIconContainer *container,
/* Let the pixbufs go. */
g_object_unref (pixbuf);
- g_list_foreach(emblem_pixbufs, (GFunc) g_object_unref, NULL);
- g_list_free(emblem_pixbufs);
+ g_list_free_full (emblem_pixbufs, g_object_unref);
g_free (editable_text);
g_free (additional_text);
diff --git a/libcaja-private/caja-merged-directory.c b/libcaja-private/caja-merged-directory.c
index a3e2a9b2..bb7ce9eb 100644
--- a/libcaja-private/caja-merged-directory.c
+++ b/libcaja-private/caja-merged-directory.c
@@ -33,6 +33,8 @@
#include <eel/eel-gtk-macros.h>
#include <gtk/gtk.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct CajaMergedDirectoryDetails
{
GList *directories;
@@ -589,8 +591,7 @@ real_directory_notify_files_removed (CajaDirectory *real_directory)
caja_directory_notify_files_removed_by_uri (files);
}
- g_list_foreach(files, (GFunc) g_free, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_free);
}
static void
diff --git a/libcaja-private/caja-mime-actions.c b/libcaja-private/caja-mime-actions.c
index 4668e0ac..bbcc6f4d 100644
--- a/libcaja-private/caja-mime-actions.c
+++ b/libcaja-private/caja-mime-actions.c
@@ -44,6 +44,8 @@
#include "caja-debug-log.h"
#include "caja-open-with-dialog.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef enum
{
ACTIVATION_ACTION_LAUNCH_DESKTOP_FILE,
@@ -230,8 +232,7 @@ static void
application_launch_parameters_free (ApplicationLaunchParameters *parameters)
{
g_object_unref (parameters->application);
- g_list_foreach(parameters->uris, (GFunc) g_free, NULL);
- g_list_free(parameters->uris);
+ g_list_free_full (parameters->uris, g_free);
g_free (parameters);
}
@@ -513,8 +514,7 @@ caja_mime_has_any_applications_for_file (CajaFile *file)
if (apps)
{
result = TRUE;
- g_list_foreach(apps, (GFunc) g_object_unref, NULL);
- g_list_free(apps);
+ g_list_free_full (apps, g_object_unref);
}
else
{
@@ -735,8 +735,7 @@ trash_or_delete_files (GtkWindow *parent_window,
caja_file_operations_trash_or_delete (locations,
parent_window,
NULL, NULL);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
}
static void
diff --git a/libcaja-private/caja-mime-application-chooser.c b/libcaja-private/caja-mime-application-chooser.c
index dd8af544..21c56c1a 100644
--- a/libcaja-private/caja-mime-application-chooser.c
+++ b/libcaja-private/caja-mime-application-chooser.c
@@ -39,6 +39,8 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct _CajaMimeApplicationChooserDetails
{
char *uri;
@@ -563,8 +565,7 @@ refresh_model (CajaMimeApplicationChooser *chooser)
g_object_unref (default_app);
}
- g_list_foreach(applications, (GFunc) g_object_unref, NULL);
- g_list_free(applications);
+ g_list_free_full (applications, g_object_unref);
}
static void
diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c
index 50ca03ef..0d7a4537 100644
--- a/libcaja-private/caja-open-with-dialog.c
+++ b/libcaja-private/caja-open-with-dialog.c
@@ -36,6 +36,8 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define sure_string(s) ((const char *)((s)!=NULL?(s):""))
#define DESKTOP_ENTRY_GROUP "Desktop Entry"
@@ -290,8 +292,7 @@ add_or_find_application (CajaOpenWithDialog *dialog)
if (applications != NULL)
{
- g_list_foreach(applications, (GFunc) g_object_unref, NULL);
- g_list_free(applications);
+ g_list_free_full (applications, g_object_unref);
}
}
diff --git a/libcaja-private/caja-program-choosing.c b/libcaja-private/caja-program-choosing.c
index f7b3fa42..bc9ee396 100644
--- a/libcaja-private/caja-program-choosing.c
+++ b/libcaja-private/caja-program-choosing.c
@@ -42,6 +42,8 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/**
* application_cannot_open_location
*
@@ -163,8 +165,7 @@ caja_launch_application (GAppInfo *application,
uris = g_list_reverse (uris);
caja_launch_application_by_uri (application, uris,
parent_window);
- g_list_foreach(uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
}
void
@@ -273,8 +274,7 @@ caja_launch_application_by_uri (GAppInfo *application,
}
}
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
}
/**
@@ -450,8 +450,7 @@ caja_launch_desktop_file (GdkScreen *screen,
" drop them again."),
parent_window);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
g_object_unref (app_info);
return;
}
@@ -503,8 +502,7 @@ caja_launch_desktop_file (GdkScreen *screen,
g_free (message);
}
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
g_object_unref (context);
g_object_unref (app_info);
}
diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c
index 9c6044af..df4a8753 100644
--- a/libcaja-private/caja-query.c
+++ b/libcaja-private/caja-query.c
@@ -30,6 +30,8 @@
#include <glib/gi18n.h>
#include <libcaja-private/caja-file-utilities.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct CajaQueryDetails
{
char *text;
@@ -118,10 +120,7 @@ caja_query_get_mime_types (CajaQuery *query)
void
caja_query_set_mime_types (CajaQuery *query, GList *mime_types)
{
- g_list_foreach(query->details->mime_types, (GFunc) g_free, NULL);
- g_list_free(query->details->mime_types);
- g_list_foreach(query->details->mime_types, (GFunc) g_free, NULL);
- g_list_free(query->details->mime_types);
+ g_list_free_full (query->details->mime_types, g_free);
query->details->mime_types = eel_g_str_list_copy (mime_types);
}
diff --git a/libcaja-private/caja-search-engine-beagle.c b/libcaja-private/caja-search-engine-beagle.c
index 6e59b060..1b63bb28 100644
--- a/libcaja-private/caja-search-engine-beagle.c
+++ b/libcaja-private/caja-search-engine-beagle.c
@@ -27,6 +27,8 @@
#include <eel/eel-gtk-macros.h>
#include <gmodule.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef struct _BeagleHit BeagleHit;
typedef struct _BeagleQuery BeagleQuery;
typedef struct _BeagleClient BeagleClient;
@@ -341,8 +343,7 @@ caja_search_engine_beagle_start (CajaSearchEngine *engine)
/* These must live during the lifetime of the query */
g_free (text);
- g_list_foreach(mimetypes, (GFunc) g_free, NULL);
- g_list_free(mimetypes);
+ g_list_free_full (mimetypes, g_free);
}
static void
diff --git a/libcaja-private/caja-search-engine-simple.c b/libcaja-private/caja-search-engine-simple.c
index cf50497f..dc30dbe8 100644
--- a/libcaja-private/caja-search-engine-simple.c
+++ b/libcaja-private/caja-search-engine-simple.c
@@ -30,6 +30,8 @@
#include <eel/eel-gtk-macros.h>
#include <gio/gio.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define BATCH_SIZE 500
typedef struct
@@ -137,10 +139,8 @@ search_thread_data_free (SearchThreadData *data)
g_hash_table_destroy (data->visited);
g_object_unref (data->cancellable);
g_strfreev (data->words);
- g_list_foreach(data->mime_types, (GFunc) g_free, NULL);
- g_list_free(data->mime_types);
- g_list_foreach(data->uri_hits, (GFunc) g_free, NULL);
- g_list_free(data->uri_hits);
+ g_list_free_full (data->mime_types, g_free);
+ g_list_free_full (data->uri_hits, g_free);
g_free (data);
}
@@ -182,8 +182,7 @@ search_thread_add_hits_idle (gpointer user_data)
hits->uris);
}
- g_list_foreach(hits->uris, (GFunc) g_free, NULL);
- g_list_free(hits->uris);
+ g_list_free_full (hits->uris, g_free);
g_free (hits);
return FALSE;
diff --git a/libcaja-private/caja-search-engine-tracker.c b/libcaja-private/caja-search-engine-tracker.c
index e47af045..edf725c8 100644
--- a/libcaja-private/caja-search-engine-tracker.c
+++ b/libcaja-private/caja-search-engine-tracker.c
@@ -27,6 +27,7 @@
#include <gmodule.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
typedef struct _TrackerClient TrackerClient;
@@ -306,8 +307,7 @@ search_callback (gpointer results, GError *error, gpointer user_data)
caja_search_engine_hits_added (CAJA_SEARCH_ENGINE (tracker), hit_uris);
caja_search_engine_finished (CAJA_SEARCH_ENGINE (tracker));
- g_list_foreach (hit_uris, (GFunc) g_free, NULL);
- g_list_free (hit_uris);
+ g_list_free_full (hit_uris, g_free);
}
@@ -461,8 +461,7 @@ caja_search_engine_tracker_start (CajaSearchEngine *engine)
tracker->details->query_pending = TRUE;
g_free (search_text);
- g_list_foreach(mimetypes, (GFunc) g_free, NULL);
- g_list_free(mimetypes);
+ g_list_free_full (mimetypes, g_free);
}
static void
diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c
index 0a19934e..08dd827e 100644
--- a/libcaja-private/caja-undostack-manager.c
+++ b/libcaja-private/caja-undostack-manager.c
@@ -34,6 +34,8 @@
#include <locale.h>
#include <gdk/gdk.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* *****************************************************************
Private fields
***************************************************************** */
@@ -431,8 +433,7 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_copy (uris, NULL,
action->dest_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_CREATEFILEFROMTEMPLATE:
puri = get_uri_parent (action->target_uri);
@@ -448,16 +449,14 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_duplicate (uris, NULL, NULL,
undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_RESTOREFROMTRASH:
case CAJA_UNDOSTACK_MOVE:
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_move (uris, NULL,
action->dest_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_RENAME:
new_name = get_uri_basename (action->new_uri);
@@ -491,16 +490,14 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager,
caja_file_operations_trash_or_delete
(uris, NULL, undo_redo_done_delete_callback, action);
g_list_free (uri_to_trash);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
}
break;
case CAJA_UNDOSTACK_CREATELINK:
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_link (uris, NULL,
action->dest_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_SETPERMISSIONS:
file = caja_file_get_by_uri (action->target_uri);
@@ -583,8 +580,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager,
if (priv->confirm_delete) {
caja_file_operations_delete (uris, NULL,
undo_redo_done_delete_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
} else {
/* We skip the confirmation message
*/
@@ -605,8 +601,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->destinations, action->dest_dir);
caja_file_operations_trash_or_delete (uris, NULL,
undo_redo_done_delete_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_MOVETOTRASH:
files_to_restore = retrieve_files_to_restore (action->trashed);
@@ -636,8 +631,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->destinations, action->dest_dir);
caja_file_operations_move (uris, NULL,
action->src_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_RENAME:
new_name = get_uri_basename (action->old_uri);
@@ -1766,12 +1760,10 @@ free_undostack_action (gpointer data, gpointer user_data)
g_free (action->new_user_name_or_id);
if (action->sources) {
- g_list_foreach (action->sources, (GFunc) g_free, NULL);
- g_list_free (action->sources);
+ g_list_free_full (action->sources, g_free);
}
if (action->destinations) {
- g_list_foreach (action->destinations, (GFunc) g_free, NULL);
- g_list_free (action->destinations);
+ g_list_free_full (action->destinations, g_free);
}
if (action->trashed) {