[gimp] Use the new g_[s]list_free_full() instead of foreach() and free()



commit fcfb7cf160d09d9261b7b9d91d9385107e5a29a5
Author: Michael Natterer <mitch gimp org>
Date:   Mon Mar 7 17:10:18 2011 +0100

    Use the new g_[s]list_free_full() instead of foreach() and free()

 app/core/gimpdata.c                          |    3 +-
 app/core/gimpimage.c                         |   14 ++++--------
 app/core/gimppalette-import.c                |    3 +-
 app/core/gimppalette.c                       |    4 +-
 app/core/gimppreviewcache.c                  |    4 +--
 app/core/gimptagcache.c                      |    3 +-
 app/dialogs/file-open-dialog.c               |    3 +-
 app/display/gimpcanvasgroup.c                |    3 +-
 app/display/gimpscalecombobox.c              |    5 +--
 app/display/gimpstatusbar.c                  |    4 +-
 app/gui/splash.c                             |    3 +-
 app/pdb/gimppdb.c                            |    5 +---
 app/plug-in/gimpplugindef.c                  |    3 +-
 app/plug-in/gimppluginmanager-restore.c      |    3 +-
 app/plug-in/gimppluginmanager.c              |    9 +++----
 app/plug-in/gimppluginprocedure.c            |   29 ++++++-------------------
 app/plug-in/gimppluginprocframe.c            |    4 +-
 app/plug-in/plug-in-rc.c                     |    3 +-
 app/tools/gimp-tools.c                       |    3 +-
 app/vectors/gimpstroke.c                     |    3 +-
 app/vectors/gimpvectors.c                    |    6 +---
 app/widgets/gimpcontainericonview.c          |    6 +---
 app/widgets/gimpcontainertreeview-dnd.c      |    3 +-
 app/widgets/gimpcontainertreeview.c          |    6 +---
 app/widgets/gimpdialogfactory.c              |    4 +-
 app/widgets/gimpdnd.c                        |    6 +---
 app/widgets/gimpfileprocview.c               |    3 +-
 app/widgets/gimpiconpicker.c                 |    3 +-
 app/widgets/gimpmenufactory.c                |    3 +-
 app/widgets/gimpselectiondata.c              |    3 +-
 app/widgets/gimpsessioninfo-book.c           |    5 +--
 app/widgets/gimpsessioninfo-dock.c           |    6 +---
 app/widgets/gimpsessioninfo-dockable.c       |    4 +-
 app/widgets/gimpsessioninfo.c                |   10 +++-----
 app/widgets/gimptagentry.c                   |    3 +-
 app/widgets/gimptextbuffer-serialize.c       |    3 +-
 app/widgets/gimpthumbbox.c                   |    3 +-
 libgimpbase/gimpenv.c                        |    3 +-
 libgimpwidgets/gimppageselector.c            |    6 +---
 libgimpwidgets/gimpwidgets-private.c         |    3 +-
 plug-ins/common/file-dicom.c                 |    9 +------
 plug-ins/fractal-explorer/fractal-explorer.c |    3 +-
 plug-ins/gfig/gfig-dialog.c                  |    3 +-
 plug-ins/gfig/gfig-dobject.c                 |    5 +--
 plug-ins/gimpressionist/utils.c              |    9 +-------
 plug-ins/gradient-flare/gradient-flare.c     |    6 +---
 plug-ins/help-browser/dialog.c               |    4 +-
 plug-ins/help-browser/help-browser.c         |    3 +-
 plug-ins/help/gimp-help-lookup.c             |    3 +-
 plug-ins/help/help.c                         |    3 +-
 plug-ins/ifs-compose/ifs-compose-storage.c   |    3 +-
 plug-ins/imagemap/imap_mru.c                 |    7 ++---
 plug-ins/imagemap/imap_polygon.c             |    7 ++---
 plug-ins/imagemap/imap_selection.c           |    5 +--
 plug-ins/script-fu/script-fu-script.c        |    5 +--
 plug-ins/script-fu/script-fu-scripts.c       |    9 ++-----
 56 files changed, 97 insertions(+), 187 deletions(-)
---
diff --git a/app/core/gimpdata.c b/app/core/gimpdata.c
index 30f90cd..5a245d8 100644
--- a/app/core/gimpdata.c
+++ b/app/core/gimpdata.c
@@ -266,8 +266,7 @@ gimp_data_finalize (GObject *object)
 
   if (private->tags)
     {
-      g_list_foreach (private->tags, (GFunc) g_object_unref, NULL);
-      g_list_free (private->tags);
+      g_list_free_full (private->tags, (GDestroyNotify) g_object_unref);
       private->tags = NULL;
     }
 
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 43b1c43..7e1943b 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -966,8 +966,7 @@ gimp_image_finalize (GObject *object)
 
   if (private->guides)
     {
-      g_list_foreach (private->guides, (GFunc) g_object_unref, NULL);
-      g_list_free (private->guides);
+      g_list_free_full (private->guides, (GDestroyNotify) g_object_unref);
       private->guides = NULL;
     }
 
@@ -979,9 +978,8 @@ gimp_image_finalize (GObject *object)
 
   if (private->sample_points)
     {
-      g_list_foreach (private->sample_points,
-                      (GFunc) gimp_sample_point_unref, NULL);
-      g_list_free (private->sample_points);
+      g_list_free_full (private->sample_points,
+                        (GDestroyNotify) gimp_sample_point_unref);
       private->sample_points = NULL;
     }
 
@@ -1138,12 +1136,10 @@ gimp_image_size_changed (GimpViewable *viewable)
   g_list_free (all_items);
 
   all_items = gimp_image_get_channel_list (image);
-  g_list_foreach (all_items, (GFunc) gimp_viewable_size_changed, NULL);
-  g_list_free (all_items);
+  g_list_free_full (all_items, (GDestroyNotify) gimp_viewable_size_changed);
 
   all_items = gimp_image_get_vectors_list (image);
-  g_list_foreach (all_items, (GFunc) gimp_viewable_size_changed, NULL);
-  g_list_free (all_items);
+  g_list_free_full (all_items, (GDestroyNotify) gimp_viewable_size_changed);
 
   gimp_viewable_size_changed (GIMP_VIEWABLE (gimp_image_get_mask (image)));
 
diff --git a/app/core/gimppalette-import.c b/app/core/gimppalette-import.c
index 2a2dd39..10dbb0f 100644
--- a/app/core/gimppalette-import.c
+++ b/app/core/gimppalette-import.c
@@ -556,8 +556,7 @@ gimp_palette_import_from_file (GimpContext  *context,
 
       gimp_object_set_name (GIMP_OBJECT (palette), palette_name);
 
-      g_list_foreach (palette_list, (GFunc) g_object_unref, NULL);
-      g_list_free (palette_list);
+      g_list_free_full (palette_list, (GDestroyNotify) g_object_unref);
 
       return palette;
     }
diff --git a/app/core/gimppalette.c b/app/core/gimppalette.c
index 9c69d08..ba826e7 100644
--- a/app/core/gimppalette.c
+++ b/app/core/gimppalette.c
@@ -125,8 +125,8 @@ gimp_palette_finalize (GObject *object)
 
   if (palette->colors)
     {
-      g_list_foreach (palette->colors, (GFunc) gimp_palette_entry_free, NULL);
-      g_list_free (palette->colors);
+      g_list_free_full (palette->colors,
+                        (GDestroyNotify) gimp_palette_entry_free);
       palette->colors = NULL;
     }
 
diff --git a/app/core/gimppreviewcache.c b/app/core/gimppreviewcache.c
index 5b5b052..17cb03d 100644
--- a/app/core/gimppreviewcache.c
+++ b/app/core/gimppreviewcache.c
@@ -155,9 +155,7 @@ gimp_preview_cache_invalidate (GSList **plist)
   preview_cache_print (*plist);
 #endif
 
-  g_slist_foreach (*plist, (GFunc) temp_buf_free, NULL);
-
-  g_slist_free (*plist);
+  g_slist_free_full (*plist, (GDestroyNotify) temp_buf_free);
   *plist = NULL;
 }
 
diff --git a/app/core/gimptagcache.c b/app/core/gimptagcache.c
index 9434006..d93b96f 100644
--- a/app/core/gimptagcache.c
+++ b/app/core/gimptagcache.c
@@ -157,8 +157,7 @@ gimp_tag_cache_finalize (GObject *object)
           GimpTagCacheRecord *rec = &g_array_index (cache->priv->records,
                                                     GimpTagCacheRecord, i);
 
-          g_list_foreach (rec->tags, (GFunc) g_object_unref, NULL);
-          g_list_free (rec->tags);
+          g_list_free_full (rec->tags, (GDestroyNotify) g_object_unref);
         }
 
       g_array_free (cache->priv->records, TRUE);
diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c
index c82c004..fe067aa 100644
--- a/app/dialogs/file-open-dialog.c
+++ b/app/dialogs/file-open-dialog.c
@@ -203,8 +203,7 @@ file_open_dialog_response (GtkWidget *open_dialog,
       gimp_file_dialog_set_sensitive (dialog, TRUE);
     }
 
-  g_slist_foreach (uris, (GFunc) g_free, NULL);
-  g_slist_free (uris);
+  g_slist_free_full (uris, (GDestroyNotify) g_free);
 }
 
 static GimpImage *
diff --git a/app/display/gimpcanvasgroup.c b/app/display/gimpcanvasgroup.c
index 05c29cc..ab31d61 100644
--- a/app/display/gimpcanvasgroup.c
+++ b/app/display/gimpcanvasgroup.c
@@ -122,8 +122,7 @@ gimp_canvas_group_dispose (GObject *object)
 
   if (private->items)
     {
-      g_list_foreach (private->items, (GFunc) g_object_unref, NULL);
-      g_list_free (private->items);
+      g_list_free_full (private->items, (GDestroyNotify) g_object_unref);
       private->items = NULL;
     }
 
diff --git a/app/display/gimpscalecombobox.c b/app/display/gimpscalecombobox.c
index 4a35e0d..2529809 100644
--- a/app/display/gimpscalecombobox.c
+++ b/app/display/gimpscalecombobox.c
@@ -191,9 +191,8 @@ gimp_scale_combo_box_finalize (GObject *object)
 
   if (combo_box->mru)
     {
-      g_list_foreach (combo_box->mru,
-                      (GFunc) gtk_tree_row_reference_free, NULL);
-      g_list_free (combo_box->mru);
+      g_list_free_full (combo_box->mru,
+                        (GDestroyNotify) gtk_tree_row_reference_free);
       combo_box->mru = NULL;
     }
 
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 48599a5..99e49cc 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -282,8 +282,8 @@ gimp_statusbar_finalize (GObject *object)
       statusbar->icon = NULL;
     }
 
-  g_slist_foreach (statusbar->messages, (GFunc) gimp_statusbar_msg_free, NULL);
-  g_slist_free (statusbar->messages);
+  g_slist_free_full (statusbar->messages,
+                     (GDestroyNotify) gimp_statusbar_msg_free);
   statusbar->messages = NULL;
 
   if (statusbar->context_ids)
diff --git a/app/gui/splash.c b/app/gui/splash.c
index 8be54b8..21e19a0 100644
--- a/app/gui/splash.c
+++ b/app/gui/splash.c
@@ -495,8 +495,7 @@ splash_image_pick_from_dir (const gchar *dirname,
           if (be_verbose)
             g_printerr (pixbuf ? "OK\n" : "failed\n");
 
-          g_list_foreach (splashes, (GFunc) g_free, NULL);
-          g_list_free (splashes);
+          g_list_free_full (splashes, (GDestroyNotify) g_free);
         }
     }
 
diff --git a/app/pdb/gimppdb.c b/app/pdb/gimppdb.c
index 0f35fca..397ea0c 100644
--- a/app/pdb/gimppdb.c
+++ b/app/pdb/gimppdb.c
@@ -464,10 +464,7 @@ gimp_pdb_entry_free (gpointer key,
                      gpointer user_data)
 {
   if (value)
-    {
-      g_list_foreach (value, (GFunc) g_object_unref, NULL);
-      g_list_free (value);
-    }
+    g_list_free_full (value, (GDestroyNotify) g_object_unref);
 }
 
 static gint64
diff --git a/app/plug-in/gimpplugindef.c b/app/plug-in/gimpplugindef.c
index 15983d1..b56672d 100644
--- a/app/plug-in/gimpplugindef.c
+++ b/app/plug-in/gimpplugindef.c
@@ -67,8 +67,7 @@ gimp_plug_in_def_finalize (GObject *object)
   g_free (plug_in_def->help_domain_name);
   g_free (plug_in_def->help_domain_uri);
 
-  g_slist_foreach (plug_in_def->procedures, (GFunc) g_object_unref, NULL);
-  g_slist_free (plug_in_def->procedures);
+  g_slist_free_full (plug_in_def->procedures, (GDestroyNotify) g_object_unref);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
diff --git a/app/plug-in/gimppluginmanager-restore.c b/app/plug-in/gimppluginmanager-restore.c
index d211838..3e059f8 100644
--- a/app/plug-in/gimppluginmanager-restore.c
+++ b/app/plug-in/gimppluginmanager-restore.c
@@ -167,8 +167,7 @@ gimp_plug_in_manager_restore (GimpPlugInManager  *manager,
     }
 
   /* we're done with the plug-in-defs */
-  g_slist_foreach (manager->plug_in_defs, (GFunc) g_object_unref, NULL);
-  g_slist_free (manager->plug_in_defs);
+  g_slist_free_full (manager->plug_in_defs, (GDestroyNotify) g_object_unref);
   manager->plug_in_defs = NULL;
 
   /* bind plug-in text domains  */
diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c
index da7d4ff..49b79d3 100644
--- a/app/plug-in/gimppluginmanager.c
+++ b/app/plug-in/gimppluginmanager.c
@@ -194,16 +194,15 @@ gimp_plug_in_manager_finalize (GObject *object)
 
   if (manager->plug_in_procedures)
     {
-      g_slist_foreach (manager->plug_in_procedures,
-                       (GFunc) g_object_unref, NULL);
-      g_slist_free (manager->plug_in_procedures);
+      g_slist_free_full (manager->plug_in_procedures,
+                         (GDestroyNotify) g_object_unref);
       manager->plug_in_procedures = NULL;
     }
 
   if (manager->plug_in_defs)
     {
-      g_slist_foreach (manager->plug_in_defs, (GFunc) g_object_unref, NULL);
-      g_slist_free (manager->plug_in_defs);
+      g_slist_free_full (manager->plug_in_defs,
+                         (GDestroyNotify) g_object_unref);
       manager->plug_in_defs = NULL;
     }
 
diff --git a/app/plug-in/gimppluginprocedure.c b/app/plug-in/gimppluginprocedure.c
index d42093e..52a2b4b 100644
--- a/app/plug-in/gimppluginprocedure.c
+++ b/app/plug-in/gimppluginprocedure.c
@@ -125,8 +125,7 @@ gimp_plug_in_procedure_finalize (GObject *object)
   g_free (proc->prog);
   g_free (proc->menu_label);
 
-  g_list_foreach (proc->menu_paths, (GFunc) g_free, NULL);
-  g_list_free (proc->menu_paths);
+  g_list_free_full (proc->menu_paths, (GDestroyNotify) g_free);
 
   g_free (proc->label);
 
@@ -138,14 +137,9 @@ gimp_plug_in_procedure_finalize (GObject *object)
   g_free (proc->magics);
   g_free (proc->mime_type);
 
-  g_slist_foreach (proc->extensions_list, (GFunc) g_free, NULL);
-  g_slist_free (proc->extensions_list);
-
-  g_slist_foreach (proc->prefixes_list, (GFunc) g_free, NULL);
-  g_slist_free (proc->prefixes_list);
-
-  g_slist_foreach (proc->magics_list, (GFunc) g_free, NULL);
-  g_slist_free (proc->magics_list);
+  g_slist_free_full (proc->extensions_list, (GDestroyNotify) g_free);
+  g_slist_free_full (proc->prefixes_list, (GDestroyNotify) g_free);
+  g_slist_free_full (proc->magics_list, (GDestroyNotify) g_free);
 
   g_free (proc->thumb_loader);
 
@@ -882,10 +876,7 @@ gimp_plug_in_procedure_set_file_proc (GimpPlugInProcedure *proc,
     }
 
   if (proc->extensions_list)
-    {
-      g_slist_foreach (proc->extensions_list, (GFunc) g_free, NULL);
-      g_slist_free (proc->extensions_list);
-    }
+    g_slist_free_full (proc->extensions_list, (GDestroyNotify) g_free);
 
   proc->extensions_list = extensions_parse (proc->extensions);
 
@@ -900,10 +891,7 @@ gimp_plug_in_procedure_set_file_proc (GimpPlugInProcedure *proc,
     }
 
   if (proc->prefixes_list)
-    {
-      g_slist_foreach (proc->prefixes_list, (GFunc) g_free, NULL);
-      g_slist_free (proc->prefixes_list);
-    }
+    g_slist_free_full (proc->prefixes_list, (GDestroyNotify) g_free);
 
   proc->prefixes_list = extensions_parse (proc->prefixes);
 
@@ -931,10 +919,7 @@ gimp_plug_in_procedure_set_file_proc (GimpPlugInProcedure *proc,
     }
 
   if (proc->magics_list)
-    {
-      g_slist_foreach (proc->magics_list, (GFunc) g_free, NULL);
-      g_slist_free (proc->magics_list);
-    }
+    g_slist_free_full (proc->magics_list, (GDestroyNotify) g_free);
 
   proc->magics_list = extensions_parse (proc->magics);
 }
diff --git a/app/plug-in/gimppluginprocframe.c b/app/plug-in/gimppluginprocframe.c
index a0be2ae..4b57b66 100644
--- a/app/plug-in/gimppluginprocframe.c
+++ b/app/plug-in/gimppluginprocframe.c
@@ -106,8 +106,8 @@ gimp_plug_in_proc_frame_dispose (GimpPlugInProcFrame *proc_frame,
 
   if (proc_frame->context_stack)
     {
-      g_list_foreach (proc_frame->context_stack, (GFunc) g_object_unref, NULL);
-      g_list_free (proc_frame->context_stack);
+      g_list_free_full (proc_frame->context_stack,
+                        (GDestroyNotify) g_object_unref);
       proc_frame->context_stack = NULL;
     }
 
diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c
index 64c3862..111034f 100644
--- a/app/plug-in/plug-in-rc.c
+++ b/app/plug-in/plug-in-rc.c
@@ -212,8 +212,7 @@ plug_in_rc_parse (Gimp         *gimp,
                                  _("fatal parse error"), TRUE);
         }
 
-      g_slist_foreach (plug_in_defs, (GFunc) g_object_unref, NULL);
-      g_slist_free (plug_in_defs);
+      g_slist_free_full (plug_in_defs, (GDestroyNotify) g_object_unref);
       plug_in_defs = NULL;
     }
 
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 8d38503..7dbe40d 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -224,8 +224,7 @@ gimp_tools_exit (Gimp *gimp)
   default_order = g_object_get_data (G_OBJECT (gimp),
                                      "gimp-tools-default-order");
 
-  g_list_foreach (default_order, (GFunc) g_free, NULL);
-  g_list_free (default_order);
+  g_list_free_full (default_order, (GDestroyNotify) g_free);
 
   g_object_set_data (G_OBJECT (gimp), "gimp-tools-default-order", NULL);
 
diff --git a/app/vectors/gimpstroke.c b/app/vectors/gimpstroke.c
index deff85f..ccc3caf 100644
--- a/app/vectors/gimpstroke.c
+++ b/app/vectors/gimpstroke.c
@@ -332,8 +332,7 @@ gimp_stroke_finalize (GObject *object)
 
   if (stroke->anchors)
     {
-      g_list_foreach (stroke->anchors, (GFunc) gimp_anchor_free, NULL);
-      g_list_free (stroke->anchors);
+      g_list_free_full (stroke->anchors, (GDestroyNotify) gimp_anchor_free);
       stroke->anchors = NULL;
     }
 
diff --git a/app/vectors/gimpvectors.c b/app/vectors/gimpvectors.c
index 97f463f..3b25a8d 100644
--- a/app/vectors/gimpvectors.c
+++ b/app/vectors/gimpvectors.c
@@ -268,8 +268,7 @@ gimp_vectors_finalize (GObject *object)
 
   if (vectors->strokes)
     {
-      g_list_foreach (vectors->strokes, (GFunc) g_object_unref, NULL);
-      g_list_free (vectors->strokes);
+      g_list_free_full (vectors->strokes, (GDestroyNotify) g_object_unref);
       vectors->strokes = NULL;
     }
 
@@ -697,8 +696,7 @@ gimp_vectors_copy_strokes (const GimpVectors *src_vectors,
 
   if (dest_vectors->strokes)
     {
-      g_list_foreach (dest_vectors->strokes, (GFunc) g_object_unref, NULL);
-      g_list_free (dest_vectors->strokes);
+      g_list_free_full (dest_vectors->strokes, (GDestroyNotify) g_object_unref);
     }
 
   dest_vectors->strokes = NULL;
diff --git a/app/widgets/gimpcontainericonview.c b/app/widgets/gimpcontainericonview.c
index afc8d84..0ccf154 100644
--- a/app/widgets/gimpcontainericonview.c
+++ b/app/widgets/gimpcontainericonview.c
@@ -757,8 +757,7 @@ gimp_container_icon_view_get_selected_single (GimpContainerIconView  *icon_view,
       retval = FALSE;
     }
 
-  g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL);
-  g_list_free (selected_items);
+  g_list_free_full (selected_items, (GDestroyNotify) gtk_tree_path_free);
 
   return retval;
 }
@@ -803,8 +802,7 @@ gimp_container_icon_view_get_selected (GimpContainerView    *view,
       *items = g_list_reverse (*items);
     }
 
-  g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL);
-  g_list_free (selected_items);
+  g_list_free_full (selected_items, (GDestroyNotify) gtk_tree_path_free);
 
   return selected_count;
 }
diff --git a/app/widgets/gimpcontainertreeview-dnd.c b/app/widgets/gimpcontainertreeview-dnd.c
index 8fdcab6..4183b6d 100644
--- a/app/widgets/gimpcontainertreeview-dnd.c
+++ b/app/widgets/gimpcontainertreeview-dnd.c
@@ -401,8 +401,7 @@ gimp_container_tree_view_drag_data_received (GtkWidget             *widget,
                   tree_view_class->drop_uri_list (tree_view, uri_list,
                                                   dest_viewable, drop_pos);
 
-                  g_list_foreach (uri_list, (GFunc) g_free, NULL);
-                  g_list_free (uri_list);
+                  g_list_free_full (uri_list, (GDestroyNotify) g_free);
 
                   success = TRUE;
                 }
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index ea87894..4673818 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -1264,8 +1264,7 @@ gimp_container_tree_view_get_selected_single (GimpContainerTreeView  *tree_view,
       gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->model), iter,
                                (GtkTreePath *) selected_rows->data);
 
-      g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
-      g_list_free (selected_rows);
+      g_list_free_full (selected_rows, (GDestroyNotify) gtk_tree_path_free);
 
       return TRUE;
     }
@@ -1316,8 +1315,7 @@ gimp_container_tree_view_get_selected (GimpContainerView    *view,
       g_object_unref (renderer);
     }
 
-  g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
-  g_list_free (selected_rows);
+  g_list_free_full (selected_rows, (GDestroyNotify) gtk_tree_path_free);
 
   *items = g_list_reverse (*items);
 
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index ca8df26..3ec97cb 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -190,8 +190,8 @@ gimp_dialog_factory_dispose (GObject *object)
 
   if (factory->p->session_infos)
     {
-      g_list_foreach (factory->p->session_infos, (GFunc) g_object_unref, NULL);
-      g_list_free (factory->p->session_infos);
+      g_list_free_full (factory->p->session_infos,
+                        (GDestroyNotify) g_object_unref);
       factory->p->session_infos = NULL;
     }
 
diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c
index bfbec26..f0454f5 100644
--- a/app/widgets/gimpdnd.c
+++ b/app/widgets/gimpdnd.c
@@ -1053,8 +1053,7 @@ gimp_dnd_get_uri_list_data (GtkWidget        *widget,
     {
       gimp_selection_data_set_uri_list (selection, uri_list);
 
-      g_list_foreach (uri_list, (GFunc) g_free, NULL);
-      g_list_free (uri_list);
+      g_list_free_full (uri_list, (GDestroyNotify) g_free);
     }
 }
 
@@ -1074,8 +1073,7 @@ gimp_dnd_set_uri_list_data (GtkWidget        *widget,
   (* (GimpDndDropUriListFunc) set_uri_list_func) (widget, x, y, uri_list,
                                                   set_uri_list_data);
 
-  g_list_foreach (uri_list, (GFunc) g_free, NULL);
-  g_list_free (uri_list);
+  g_list_free_full (uri_list, (GDestroyNotify) g_free);
 
   return TRUE;
 }
diff --git a/app/widgets/gimpfileprocview.c b/app/widgets/gimpfileprocview.c
index 42937e8..f3010c8 100644
--- a/app/widgets/gimpfileprocview.c
+++ b/app/widgets/gimpfileprocview.c
@@ -96,8 +96,7 @@ gimp_file_proc_view_finalize (GObject *object)
 
   if (view->meta_extensions)
     {
-      g_list_foreach (view->meta_extensions, (GFunc) g_free, NULL);
-      g_list_free (view->meta_extensions);
+      g_list_free_full (view->meta_extensions, (GDestroyNotify) g_free);
       view->meta_extensions = NULL;
     }
 
diff --git a/app/widgets/gimpiconpicker.c b/app/widgets/gimpiconpicker.c
index a31431e..276bc2c 100644
--- a/app/widgets/gimpiconpicker.c
+++ b/app/widgets/gimpiconpicker.c
@@ -152,8 +152,7 @@ gimp_icon_picker_constructed (GObject *object)
                                    GIMP_TEMPLATE (object));
     }
 
-  g_slist_foreach (stock_list, (GFunc) g_free, NULL);
-  g_slist_free (stock_list);
+  g_slist_free_full (stock_list, (GDestroyNotify) g_free);
 
   button = gimp_viewable_button_new (private->stock_id_container,
                                      private->stock_id_context,
diff --git a/app/widgets/gimpmenufactory.c b/app/widgets/gimpmenufactory.c
index bc9acaf..731ebe6 100644
--- a/app/widgets/gimpmenufactory.c
+++ b/app/widgets/gimpmenufactory.c
@@ -82,8 +82,7 @@ gimp_menu_factory_finalize (GObject *object)
 
       g_free (entry->identifier);
 
-      g_list_foreach (entry->action_groups, (GFunc) g_free, NULL);
-      g_list_free (entry->action_groups);
+      g_list_free_full (entry->action_groups, (GDestroyNotify) g_free);
 
       for (uis = entry->managed_uis; uis; uis = g_list_next (uis))
         {
diff --git a/app/widgets/gimpselectiondata.c b/app/widgets/gimpselectiondata.c
index ff0c589..81311bc 100644
--- a/app/widgets/gimpselectiondata.c
+++ b/app/widgets/gimpselectiondata.c
@@ -272,8 +272,7 @@ gimp_selection_data_get_uri_list (GtkSelectionData *selection)
       uri_list = g_list_prepend (uri_list, uri);
     }
 
-  g_list_foreach (crap_list, (GFunc) g_free, NULL);
-  g_list_free (crap_list);
+  g_list_free_full (crap_list, (GDestroyNotify) g_free);
 
   return uri_list;
 }
diff --git a/app/widgets/gimpsessioninfo-book.c b/app/widgets/gimpsessioninfo-book.c
index d88f3b0..05c65da 100644
--- a/app/widgets/gimpsessioninfo-book.c
+++ b/app/widgets/gimpsessioninfo-book.c
@@ -59,9 +59,8 @@ gimp_session_info_book_free (GimpSessionInfoBook *info)
 
   if (info->dockables)
     {
-      g_list_foreach (info->dockables, (GFunc) gimp_session_info_dockable_free,
-                      NULL);
-      g_list_free (info->dockables);
+      g_list_free_full (info->dockables,
+                        (GDestroyNotify) gimp_session_info_dockable_free);
       info->dockables = NULL;
     }
 
diff --git a/app/widgets/gimpsessioninfo-dock.c b/app/widgets/gimpsessioninfo-dock.c
index 2920de8..e1ad090 100644
--- a/app/widgets/gimpsessioninfo-dock.c
+++ b/app/widgets/gimpsessioninfo-dock.c
@@ -69,10 +69,8 @@ gimp_session_info_dock_free (GimpSessionInfoDock *dock_info)
 
   if (dock_info->books)
     {
-      g_list_foreach (dock_info->books,
-                      (GFunc) gimp_session_info_book_free,
-                      NULL);
-      g_list_free (dock_info->books);
+      g_list_free_full (dock_info->books,
+                        (GDestroyNotify) gimp_session_info_book_free);
       dock_info->books = NULL;
     }
 
diff --git a/app/widgets/gimpsessioninfo-dockable.c b/app/widgets/gimpsessioninfo-dockable.c
index 8f268ea..83ecff0 100644
--- a/app/widgets/gimpsessioninfo-dockable.c
+++ b/app/widgets/gimpsessioninfo-dockable.c
@@ -66,8 +66,8 @@ gimp_session_info_dockable_free (GimpSessionInfoDockable *info)
 
   if (info->aux_info)
     {
-      g_list_foreach (info->aux_info, (GFunc) gimp_session_info_aux_free, NULL);
-      g_list_free (info->aux_info);
+      g_list_free_full (info->aux_info,
+                        (GDestroyNotify) gimp_session_info_aux_free);
       info->aux_info = NULL;
     }
 
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index f0b1fad..3910514 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -740,17 +740,15 @@ gimp_session_info_clear_info (GimpSessionInfo *info)
 
   if (info->p->aux_info)
     {
-      g_list_foreach (info->p->aux_info,
-                      (GFunc) gimp_session_info_aux_free, NULL);
-      g_list_free (info->p->aux_info);
+      g_list_free_full (info->p->aux_info,
+                        (GDestroyNotify) gimp_session_info_aux_free);
       info->p->aux_info = NULL;
     }
 
    if (info->p->docks)
      {
-       g_list_foreach (info->p->docks,
-                       (GFunc) gimp_session_info_dock_free, NULL);
-       g_list_free (info->p->docks);
+       g_list_free_full (info->p->docks,
+                         (GDestroyNotify) gimp_session_info_dock_free);
        info->p->docks = NULL;
      }
 }
diff --git a/app/widgets/gimptagentry.c b/app/widgets/gimptagentry.c
index 934c3d4..982f9db 100644
--- a/app/widgets/gimptagentry.c
+++ b/app/widgets/gimptagentry.c
@@ -231,8 +231,7 @@ gimp_tag_entry_dispose (GObject *object)
 
   if (entry->recent_list)
     {
-      g_list_foreach (entry->recent_list, (GFunc) g_free, NULL);
-      g_list_free (entry->recent_list);
+      g_list_free_full (entry->recent_list, (GDestroyNotify) g_free);
       entry->recent_list = NULL;
     }
 
diff --git a/app/widgets/gimptextbuffer-serialize.c b/app/widgets/gimptextbuffer-serialize.c
index b7879ec..d82fe5c 100644
--- a/app/widgets/gimptextbuffer-serialize.c
+++ b/app/widgets/gimptextbuffer-serialize.c
@@ -552,8 +552,7 @@ parse_info_free (ParseInfo *info)
   g_slist_free (info->tag_stack);
   g_slist_free (info->states);
 
-  g_list_foreach (info->spans, (GFunc) text_span_free, NULL);
-  g_list_free (info->spans);
+  g_list_free_full (info->spans, (GDestroyNotify) text_span_free);
 }
 
 static void
diff --git a/app/widgets/gimpthumbbox.c b/app/widgets/gimpthumbbox.c
index 357cf4e..80072a3 100644
--- a/app/widgets/gimpthumbbox.c
+++ b/app/widgets/gimpthumbbox.c
@@ -480,8 +480,7 @@ gimp_thumb_box_take_uris (GimpThumbBox *box,
 
   if (box->uris)
     {
-      g_slist_foreach (box->uris, (GFunc) g_free, NULL);
-      g_slist_free (box->uris);
+      g_slist_free_full (box->uris, (GDestroyNotify) g_free);
       box->uris = NULL;
     }
 
diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c
index 4bc5f7e..aa33478 100644
--- a/libgimpbase/gimpenv.c
+++ b/libgimpbase/gimpenv.c
@@ -732,8 +732,7 @@ gimp_path_to_str (GList *path)
 void
 gimp_path_free (GList *path)
 {
-  g_list_foreach (path, (GFunc) g_free, NULL);
-  g_list_free (path);
+  g_list_free_full (path, (GDestroyNotify) g_free);
 }
 
 /**
diff --git a/libgimpwidgets/gimppageselector.c b/libgimpwidgets/gimppageselector.c
index b368e11..a285b54 100644
--- a/libgimpwidgets/gimppageselector.c
+++ b/libgimpwidgets/gimppageselector.c
@@ -988,8 +988,7 @@ gimp_page_selector_get_selected_pages (GimpPageSelector *selector,
   qsort (array, *n_selected_pages, sizeof (gint),
          gimp_page_selector_int_compare);
 
-  g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL);
-  g_list_free (selected);
+  g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
 
   return array;
 }
@@ -1167,8 +1166,7 @@ gimp_page_selector_selection_changed (GtkIconView      *icon_view,
 
   selected = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (priv->view));
   n_selected = g_list_length (selected);
-  g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL);
-  g_list_free (selected);
+  g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
 
   if (n_selected == 0)
     {
diff --git a/libgimpwidgets/gimpwidgets-private.c b/libgimpwidgets/gimpwidgets-private.c
index 26ba4d0..61f9ac4 100644
--- a/libgimpwidgets/gimpwidgets-private.c
+++ b/libgimpwidgets/gimpwidgets-private.c
@@ -98,8 +98,7 @@ gimp_widgets_init (GimpHelpFunc          standard_help_func,
 
   gtk_window_set_default_icon_list (icon_list);
 
-  g_list_foreach (icon_list, (GFunc) g_object_unref, NULL);
-  g_list_free (icon_list);
+  g_list_free_full (icon_list, (GDestroyNotify) g_object_unref);
 
   gimp_widgets_init_foreign_enums ();
 
diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c
index d4fbe8f..5f551d3 100644
--- a/plug-ins/common/file-dicom.c
+++ b/plug-ins/common/file-dicom.c
@@ -905,13 +905,11 @@ dicom_add_element_int (GSList  *elements,
 /**
  * dicom_element_done:
  * @data: pointer to a DICOMELEMENT structure which is to be destroyed.
- * @user_data: unused.
  *
  * Destroys the DICOMELEMENT passed as @data
 **/
 static void
-dicom_element_done (gpointer data,
-                    gpointer user_data)
+dicom_element_done (gpointer data)
 {
   if (data)
     {
@@ -934,10 +932,7 @@ static void
 dicom_elements_destroy (GSList *elements)
 {
   if (elements)
-    {
-      g_slist_foreach (elements, dicom_element_done, NULL);
-      g_slist_free (elements);
-    }
+    g_slist_free_full (elements, dicom_element_done);
 }
 
 /**
diff --git a/plug-ins/fractal-explorer/fractal-explorer.c b/plug-ins/fractal-explorer/fractal-explorer.c
index 9c75a1f..37cd6df 100644
--- a/plug-ins/fractal-explorer/fractal-explorer.c
+++ b/plug-ins/fractal-explorer/fractal-explorer.c
@@ -907,8 +907,7 @@ fractalexplorer_free_everything (fractalexplorerOBJ *fractalexplorer)
 static void
 fractalexplorer_list_free_all (void)
 {
-  g_list_foreach (fractalexplorer_list, (GFunc) fractalexplorer_free, NULL);
-  g_list_free (fractalexplorer_list);
+  g_list_free_full (fractalexplorer_list, (GDestroyNotify) fractalexplorer_free);
   fractalexplorer_list = NULL;
 }
 
diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c
index 6557755..3c1507d 100644
--- a/plug-ins/gfig/gfig-dialog.c
+++ b/plug-ins/gfig/gfig-dialog.c
@@ -837,8 +837,7 @@ gfig_list_load_all (const gchar *path)
 static void
 gfig_list_free_all (void)
 {
-  g_list_foreach (gfig_list, (GFunc) gfig_free, NULL);
-  g_list_free (gfig_list);
+  g_list_free_full (gfig_list, (GDestroyNotify) gfig_free);
   gfig_list = NULL;
 }
 
diff --git a/plug-ins/gfig/gfig-dobject.c b/plug-ins/gfig/gfig-dobject.c
index d82b43c..0c2699c 100644
--- a/plug-ins/gfig/gfig-dobject.c
+++ b/plug-ins/gfig/gfig-dobject.c
@@ -913,10 +913,9 @@ free_one_obj (GfigObject *obj)
 }
 
 void
-free_all_objs (GList * objs)
+free_all_objs (GList *objs)
 {
-  g_list_foreach (objs, (GFunc)free_one_obj, NULL);
-  g_list_free (objs);
+  g_list_free_full (objs, (GDestroyNotify) free_one_obj);
 }
 
 gchar *
diff --git a/plug-ins/gimpressionist/utils.c b/plug-ins/gimpressionist/utils.c
index dd663eb..ebb07db 100644
--- a/plug-ins/gimpressionist/utils.c
+++ b/plug-ins/gimpressionist/utils.c
@@ -160,20 +160,13 @@ parsepath (void)
   return parsepath_cached_path;
 }
 
-static void
-my_g_free (gpointer data, gpointer userdata)
-{
-  g_free (data);
-}
-
 void
 free_parsepath_cache (void)
 {
   if (parsepath_cached_path != NULL)
     return;
 
-  g_list_foreach (parsepath_cached_path, my_g_free, NULL);
-  g_list_free (parsepath_cached_path);
+  g_list_free_full (parsepath_cached_path, (GDestroyNotify) g_free);
   parsepath_cached_path = NULL;
 }
 
diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c
index 1206f7c..7fb82fe 100644
--- a/plug-ins/gradient-flare/gradient-flare.c
+++ b/plug-ins/gradient-flare/gradient-flare.c
@@ -1657,8 +1657,7 @@ gflares_list_load_all (void)
 static void
 gflares_list_free_all (void)
 {
-  g_list_foreach (gflares_list, (GFunc) gflare_free, NULL);
-  g_list_free (gflares_list);
+  g_list_free_full (gflares_list, (GDestroyNotify) gflare_free);
   gflares_list = NULL;
 }
 
@@ -1971,8 +1970,7 @@ calc_deinit (void)
       return;
     }
 
-  g_list_foreach (calc.sflare_list, (GFunc) g_free, NULL);
-  g_list_free (calc.sflare_list);
+  g_list_free_full (calc.sflare_list, (GDestroyNotify) g_free);
 
   g_free (calc.glow_radial);
   g_free (calc.glow_angular);
diff --git a/plug-ins/help-browser/dialog.c b/plug-ins/help-browser/dialog.c
index 5a53e6c..fe98cdc 100644
--- a/plug-ins/help-browser/dialog.c
+++ b/plug-ins/help-browser/dialog.c
@@ -355,8 +355,8 @@ window_set_icons (GtkWidget *window)
                                                    sizes[i], NULL));
 
   gtk_window_set_icon_list (GTK_WINDOW (window), list);
-  g_list_foreach (list, (GFunc) g_object_unref, NULL);
-  g_list_free (list);
+
+  g_list_free_full (list, (GDestroyNotify) g_object_unref);
 }
 
 static void
diff --git a/plug-ins/help-browser/help-browser.c b/plug-ins/help-browser/help-browser.c
index 836c5e1..d09f2d0 100644
--- a/plug-ins/help-browser/help-browser.c
+++ b/plug-ins/help-browser/help-browser.c
@@ -270,8 +270,7 @@ help_browser_show_help (const gchar *help_domain,
       if (progress)
         gimp_help_progress_free (progress);
 
-      g_list_foreach (locales, (GFunc) g_free, NULL);
-      g_list_free (locales);
+      g_list_free_full (locales, (GDestroyNotify) g_free);
 
       if (uri)
         {
diff --git a/plug-ins/help/gimp-help-lookup.c b/plug-ins/help/gimp-help-lookup.c
index e927462..0bfbafb 100644
--- a/plug-ins/help/gimp-help-lookup.c
+++ b/plug-ins/help/gimp-help-lookup.c
@@ -145,8 +145,7 @@ lookup (const gchar *help_domain,
 
       gimp_help_progress_free (progress);
 
-      g_list_foreach (locales, (GFunc) g_free, NULL);
-      g_list_free (locales);
+      g_list_free_full (locales, (GDestroyNotify) g_free);
 
       return full_uri;
     }
diff --git a/plug-ins/help/help.c b/plug-ins/help/help.c
index 20311d5..ba3aa83 100644
--- a/plug-ins/help/help.c
+++ b/plug-ins/help/help.c
@@ -280,8 +280,7 @@ load_help_idle (gpointer data)
       if (progress)
         gimp_help_progress_free (progress);
 
-      g_list_foreach (locales, (GFunc) g_free, NULL);
-      g_list_free (locales);
+      g_list_free_full (locales, (GDestroyNotify) g_free);
 
       if (uri)
         {
diff --git a/plug-ins/ifs-compose/ifs-compose-storage.c b/plug-ins/ifs-compose/ifs-compose-storage.c
index cc470a8..535188a 100644
--- a/plug-ins/ifs-compose/ifs-compose-storage.c
+++ b/plug-ins/ifs-compose/ifs-compose-storage.c
@@ -393,8 +393,7 @@ ifsvals_parse (GScanner         *scanner,
 			     NULL,
 			     "using default values...",
 			     TRUE);
-      g_list_foreach (el_list, (GFunc)g_free, NULL);
-      g_list_free (el_list);
+      g_list_free_full (el_list, (GDestroyNotify) g_free);
       return FALSE;
     }
 
diff --git a/plug-ins/imagemap/imap_mru.c b/plug-ins/imagemap/imap_mru.c
index d023637..5b7cf61 100644
--- a/plug-ins/imagemap/imap_mru.c
+++ b/plug-ins/imagemap/imap_mru.c
@@ -38,11 +38,10 @@ mru_create(void)
 }
 
 void
-mru_destruct(MRU_t *mru)
+mru_destruct (MRU_t *mru)
 {
-   g_list_foreach(mru->list, (GFunc) g_free, NULL);
-   g_list_free (mru->list);
-   g_free(mru);
+  g_list_free_full (mru->list, (GDestroyNotify) g_free);
+  g_free (mru);
 }
 
 static void
diff --git a/plug-ins/imagemap/imap_polygon.c b/plug-ins/imagemap/imap_polygon.c
index 4065f28..a89e96b 100644
--- a/plug-ins/imagemap/imap_polygon.c
+++ b/plug-ins/imagemap/imap_polygon.c
@@ -106,11 +106,10 @@ create_polygon(GList *points)
 }
 
 static void
-polygon_free_list(Polygon_t *polygon)
+polygon_free_list (Polygon_t *polygon)
 {
-   g_list_foreach(polygon->points, (GFunc) g_free, NULL);
-   g_list_free(polygon->points);
-   polygon->points = NULL;
+  g_list_free_full (polygon->points, (GDestroyNotify) g_free);
+  polygon->points = NULL;
 }
 
 static void
diff --git a/plug-ins/imagemap/imap_selection.c b/plug-ins/imagemap/imap_selection.c
index eea7cae..d441589 100644
--- a/plug-ins/imagemap/imap_selection.c
+++ b/plug-ins/imagemap/imap_selection.c
@@ -75,9 +75,8 @@ changed_cb(GtkTreeSelection *selection, gpointer param)
 
         command_execute (command);
 
-        g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
-        g_list_free (selected_rows);
-  }
+        g_list_free_full (selected_rows, (GDestroyNotify) gtk_tree_path_free);
+      }
 }
 
 static gboolean
diff --git a/plug-ins/script-fu/script-fu-script.c b/plug-ins/script-fu/script-fu-script.c
index c8e92d0..133a032 100644
--- a/plug-ins/script-fu/script-fu-script.c
+++ b/plug-ins/script-fu/script-fu-script.c
@@ -151,9 +151,8 @@ script_fu_script_free (SFScript *script)
           break;
 
         case SF_OPTION:
-          g_slist_foreach (arg->default_value.sfa_option.list,
-                           (GFunc) g_free, NULL);
-          g_slist_free (arg->default_value.sfa_option.list);
+          g_slist_free_full (arg->default_value.sfa_option.list,
+                             (GDestroyNotify) g_free);
           break;
 
         case SF_ENUM:
diff --git a/plug-ins/script-fu/script-fu-scripts.c b/plug-ins/script-fu/script-fu-scripts.c
index fee8599..c8d9b07 100644
--- a/plug-ins/script-fu/script-fu-scripts.c
+++ b/plug-ins/script-fu/script-fu-scripts.c
@@ -119,12 +119,9 @@ script_fu_find_scripts (const gchar *path)
   script_menu_list = g_list_sort (script_menu_list,
                                   (GCompareFunc) script_fu_menu_compare);
 
-  g_list_foreach (script_menu_list,
-                  (GFunc) script_fu_install_menu,
-                  NULL);
-
-  /*  Now we are done with the list of menu entries  */
-  g_list_free (script_menu_list);
+  /*  Install and nuke the list of menu entries  */
+  g_list_free_full (script_menu_list,
+                    (GDestroyNotify) script_fu_install_menu);
   script_menu_list = NULL;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]