[goffice] Compilation: replace go_[s]list_free_custom by g_[s]list_free_full.



commit 0aa8b116df6dbc445dcb3c842d53982ea3c6bc11
Author: Morten Welinder <terra gnome org>
Date:   Thu Nov 3 14:51:31 2011 -0400

    Compilation: replace go_[s]list_free_custom by g_[s]list_free_full.

 goffice/app/go-plugin-service.c    |    4 +-
 goffice/app/go-plugin.c            |   18 ++++++++--------
 goffice/app/io-context.c           |    4 +-
 goffice/graph/gog-theme.c          |    2 +-
 goffice/gtk/go-action-combo-text.c |    2 +-
 goffice/utils/go-format.c          |    4 +-
 goffice/utils/go-glib-extras.c     |   37 ------------------------------------
 goffice/utils/go-glib-extras.h     |    2 -
 goffice/utils/go-pango-extras.c    |    6 ++--
 9 files changed, 20 insertions(+), 59 deletions(-)
---
diff --git a/goffice/app/go-plugin-service.c b/goffice/app/go-plugin-service.c
index 8a437f3..d16bf3f 100644
--- a/goffice/app/go-plugin-service.c
+++ b/goffice/app/go-plugin-service.c
@@ -249,9 +249,9 @@ go_plugin_service_file_opener_finalize (GObject *obj)
 
 	g_free (service_file_opener->description);
 	service_file_opener->description = NULL;
-	go_slist_free_custom (service_file_opener->suffixes, g_free);
+	g_slist_free_full (service_file_opener->suffixes, g_free);
 	service_file_opener->suffixes = NULL;
-	go_slist_free_custom (service_file_opener->mimes, g_free);
+	g_slist_free_full (service_file_opener->mimes, g_free);
 	service_file_opener->mimes = NULL;
 	if (service_file_opener->opener != NULL) {
 		g_object_unref (service_file_opener->opener);
diff --git a/goffice/app/go-plugin.c b/goffice/app/go-plugin.c
index 747f15e..9171d07 100644
--- a/goffice/app/go-plugin.c
+++ b/goffice/app/go-plugin.c
@@ -171,7 +171,7 @@ go_plugin_finalize (GObject *obj)
 		plugin->has_full_info = FALSE;
 		g_free (plugin->name);
 		g_free (plugin->description);
-		go_slist_free_custom (plugin->dependencies, plugin_dependency_free);
+		g_slist_free_full (plugin->dependencies, plugin_dependency_free);
 		g_free (plugin->loader_id);
 		if (plugin->loader_attrs != NULL) {
 			g_hash_table_destroy (plugin->loader_attrs);
@@ -179,7 +179,7 @@ go_plugin_finalize (GObject *obj)
 		if (plugin->loader != NULL) {
 			g_object_unref (plugin->loader);
 		}
-		go_slist_free_custom (plugin->services, g_object_unref);
+		g_slist_free_full (plugin->services, g_object_unref);
 	}
 	g_free (plugin->saved_textdomain);
 	plugin->saved_textdomain = NULL;
@@ -683,7 +683,7 @@ go_plugin_read_service_list (GOPlugin *plugin, xmlNode *tree, GOErrorInfo **ret_
 	if (error_list != NULL) {
 		GO_SLIST_REVERSE (error_list);
 		*ret_error = go_error_info_new_from_error_list (error_list);
-		go_slist_free_custom (service_list, g_object_unref);
+		g_slist_free_full (service_list, g_object_unref);
 		return NULL;
 	} else {
 		return g_slist_reverse (service_list);
@@ -869,7 +869,7 @@ go_plugin_read (GOPlugin *plugin, gchar const *dir_name, GOErrorInfo **ret_error
 		} else
 			*ret_error = go_error_info_new_str (_("Plugin has no id."));
 
-		go_slist_free_custom (dependency_list, plugin_dependency_free);
+		g_slist_free_full (dependency_list, plugin_dependency_free);
 		g_free (plugin->loader_id);
 		if (plugin->loader_attrs != NULL)
 			g_hash_table_destroy (plugin->loader_attrs);
@@ -1254,7 +1254,7 @@ go_plugin_use_unref (GOPlugin *plugin)
  * Returns: the list of identifiers of plugins that @plugin depends on.
  * 	All these plugins will be automatically activated before activating the
  * 	@plugin itself.  The caller must free the returned list together with
- * 	the strings it points to (use go_slist_free_custom (list, g_free) to do
+ * 	the strings it points to (use g_slist_free_full (list, g_free) to do
  * 	this).
  **/
 GSList *
@@ -1671,7 +1671,7 @@ go_plugins_rescan (GOErrorInfo **ret_error, GSList **ret_new_plugins)
 			_("The following plugins are no longer on disk but are still active:\n"
 			  "%s.\nYou should restart this program now."), s->str));
 		g_string_free (s, TRUE);
-		go_slist_free_custom (still_active_ids, g_free);
+		g_slist_free_full (still_active_ids, g_free);
 	}
 
 	/* Find previously not available plugins */
@@ -1685,7 +1685,7 @@ go_plugins_rescan (GOErrorInfo **ret_error, GSList **ret_new_plugins)
 			g_object_ref (plugin);
 		}
 	);
-	go_slist_free_custom (new_available_plugins, g_object_unref);
+	g_slist_free_full (new_available_plugins, g_object_unref);
 	if (ret_new_plugins != NULL) {
 		*ret_new_plugins = g_slist_copy (added_plugins);
 	}
@@ -1870,14 +1870,14 @@ go_plugins_shutdown (void)
 		&used_plugin_state_strings);
 	if (!plugin_file_state_hash_changed &&
 	    g_hash_table_size (plugin_file_state_dir_hash) == g_slist_length (used_plugin_state_strings)) {
-		go_slist_free_custom (used_plugin_state_strings, g_free);
+		g_slist_free_full (used_plugin_state_strings, g_free);
 		used_plugin_state_strings = NULL;
 	}
 
 	g_hash_table_destroy (plugin_file_state_dir_hash);
 	g_hash_table_destroy (loader_services);
 	g_hash_table_destroy (available_plugins_id_hash);
-	go_slist_free_custom (available_plugins, g_object_unref);
+	g_slist_free_full (available_plugins, g_object_unref);
 
 	if (go_plugin_dirs) {
 		g_slist_foreach (go_plugin_dirs, (GFunc) g_free, NULL);
diff --git a/goffice/app/io-context.c b/goffice/app/io-context.c
index d94a8b7..88a74bd 100644
--- a/goffice/app/io-context.c
+++ b/goffice/app/io-context.c
@@ -57,7 +57,7 @@ ioc_finalize (GObject *obj)
 	g_return_if_fail (GO_IS_IO_CONTEXT (obj));
 
 	ioc = GO_IO_CONTEXT (obj);
-	go_slist_free_custom (ioc->info, (GFreeFunc) go_error_info_free);
+	g_slist_free_full (ioc->info, (GDestroyNotify) go_error_info_free);
 	if (ioc->impl) {
 		go_cmd_context_progress_set (ioc->impl, 0.0);
 		go_cmd_context_progress_message_set (ioc->impl, NULL);
@@ -239,7 +239,7 @@ go_io_error_clear (GOIOContext *context)
 
 	context->error_occurred = FALSE;
 	context->warning_occurred = FALSE;
-	go_slist_free_custom (context->info, (GFreeFunc) go_error_info_free);
+	g_slist_free_full (context->info, (GDestroyNotify) go_error_info_free);
 	context->info = NULL;
 }
 
diff --git a/goffice/graph/gog-theme.c b/goffice/graph/gog-theme.c
index 9799efc..009b2f7 100644
--- a/goffice/graph/gog-theme.c
+++ b/goffice/graph/gog-theme.c
@@ -1171,7 +1171,7 @@ _gog_themes_shutdown (void)
 		default_theme = NULL;
 	}
 
-	go_slist_free_custom (g_slist_copy (themes), g_object_unref);
+	g_slist_free_full (g_slist_copy (themes), g_object_unref);
 	g_slist_free (themes);
 	themes = NULL;
 }
diff --git a/goffice/gtk/go-action-combo-text.c b/goffice/gtk/go-action-combo-text.c
index 2b014c6..80b82e4 100644
--- a/goffice/gtk/go-action-combo-text.c
+++ b/goffice/gtk/go-action-combo-text.c
@@ -160,7 +160,7 @@ go_action_combo_text_finalize (GObject *obj)
 {
 	GOActionComboText *taction = GO_ACTION_COMBO_TEXT (obj);
 	g_free (taction->entry_val);
-	go_slist_free_custom (taction->elements, (GFreeFunc)g_free);
+	g_slist_free_full (taction->elements, (GDestroyNotify)g_free);
 	combo_text_parent->finalize (obj);
 }
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index b06a8b6..17d8981 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -2670,7 +2670,7 @@ go_format_get_width (GString *dst, PangoAttrList *attrs, int start,
 		width += pango_glyph_string_get_width (glyphs);
 		pango_glyph_string_free (glyphs);
 	}
-	go_list_free_custom (plist, (GFreeFunc) pango_item_free);
+	g_list_free_full (plist, (GDestroyNotify) pango_item_free);
 	return width;
 }
 #endif
@@ -2705,7 +2705,7 @@ go_format_desired_width (PangoLayout *layout, PangoAttrList *attrs, int digits)
 		pango_glyph_string_free (glyphs);
 		width += logical_rect.width;
 	}
-	go_list_free_custom (plist, (GFreeFunc) pango_item_free);
+	g_list_free_full (plist, (GDestroyNotify) pango_item_free);
 
 	return (int)(1.1 * width *digits);
 }
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index 255760e..b8d8f5b 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -138,24 +138,6 @@ go_slist_map (GSList const *list, GOMapFunc map_func)
 	return g_slist_reverse (list_copy);
 }
 
-/**
- * go_slist_free_custom:
- * @list: list of some items
- * @free_func: function freeing list item
- *
- * Clears a list, calling @free_func for each list item.
- **/
-void
-go_slist_free_custom (GSList *list, GFreeFunc free_func)
-{
-	GSList *l;
-
-	for (l = list; l != NULL; l = l->next) {
-		free_func (l->data);
-	}
-	g_slist_free (list);
-}
-
 gint
 go_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
 {
@@ -172,25 +154,6 @@ go_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
 }
 
 /**
- * go_list_free_custom:
- * @list: list of some items
- * @free_func: function freeing list item
- *
- * Clears a list, calling @free_func for each list item.
- *
- */
-void
-go_list_free_custom (GList *list, GFreeFunc free_func)
-{
-	GList *l;
-
-	for (l = list; l != NULL; l = l->next) {
-		free_func (l->data);
-	}
-	g_list_free (list);
-}
-
-/**
  * go_strsplit_to_slist:
  * @str: String to split
  * @delimiter: Token delimiter
diff --git a/goffice/utils/go-glib-extras.h b/goffice/utils/go-glib-extras.h
index ae043c2..bc6c72d 100644
--- a/goffice/utils/go-glib-extras.h
+++ b/goffice/utils/go-glib-extras.h
@@ -16,7 +16,6 @@ GSList	*go_hash_values		(GHashTable *hash);
 
 GSList	*go_slist_map		(GSList const *list, GOMapFunc map_func);
 GSList	*go_slist_create	(gpointer item1, ...);
-void	 go_slist_free_custom	(GSList *list, GFreeFunc free_func);
 #define	 go_string_slist_copy(list) go_slist_map (list, (GOMapFunc) g_strdup)
 GSList	*go_strsplit_to_slist	(char const *str, gchar delimiter);
 #define GO_SLIST_FOREACH(list,valtype,val,stmnt) \
@@ -42,7 +41,6 @@ G_STMT_START { \
 	(list = g_slist_sort (list, cmp_func))
 
 gint go_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func);
-void go_list_free_custom  (GList *list, GFreeFunc free_func);
 #define GO_LIST_FOREACH(list,valtype,val,stmnt) \
 G_STMT_START { \
 	GList *go_l; \
diff --git a/goffice/utils/go-pango-extras.c b/goffice/utils/go-pango-extras.c
index b080997..4bf7033 100644
--- a/goffice/utils/go-pango-extras.c
+++ b/goffice/utils/go-pango-extras.c
@@ -414,7 +414,7 @@ go_load_pango_attributes_into_buffer (PangoAttrList  *markup, GtkTextBuffer *buf
 						break;
 					}
 				}
-				go_slist_free_custom (attr, (GFreeFunc)pango_attribute_destroy);
+				g_slist_free_full (attr, (GDestroyNotify)pango_attribute_destroy);
 			}
 		} while (pango_attr_iterator_next (iter));
 		pango_attr_iterator_destroy (iter);
@@ -475,7 +475,7 @@ go_load_pango_attributes_into_buffer (PangoAttrList  *markup, GtkTextBuffer *buf
 				gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, start);
 				gtk_text_buffer_get_iter_at_offset (buffer, &end_iter, end);
 				gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
-				go_slist_free_custom (attr, (GFreeFunc)pango_attribute_destroy);
+				g_slist_free_full (attr, (GDestroyNotify)pango_attribute_destroy);
 			}
 		} while (pango_attr_iterator_next (iter));
 		pango_attr_iterator_destroy (iter);
@@ -560,7 +560,7 @@ go_pango_translate_here (PangoAttrIterator *state_iter,
 		attr->end_index = range_end;
 		pango_attr_list_insert (attrs, attr);
 	}
-	go_slist_free_custom (the_attrs, (GFreeFunc)pango_attribute_destroy);
+	g_slist_free_full (the_attrs, (GDestroyNotify)pango_attribute_destroy);
 }
 
 



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