[devhelp] dh-book-manager: use g_list_free_full
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] dh-book-manager: use g_list_free_full
- Date: Thu, 5 Sep 2013 15:31:23 +0000 (UTC)
commit 50a4934c7c179cd3ef4e6be83fc339c88f712889
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date: Thu Sep 5 17:31:04 2013 +0200
dh-book-manager: use g_list_free_full
src/dh-book-manager.c | 21 +++------------------
1 files changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
index de129d1..073669f 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -98,33 +98,18 @@ static void
dh_book_manager_finalize (GObject *object)
{
DhBookManagerPrivate *priv;
- GList *l;
- GSList *sl;
priv = dh_book_manager_get_instance_private (DH_BOOK_MANAGER (object));
- /* Destroy all books */
- for (l = priv->books; l; l = g_list_next (l)) {
- g_object_unref (l->data);
- }
- g_list_free (priv->books);
-
- /* Free all languages */
- g_list_foreach (priv->languages,
- (GFunc)dh_language_free,
- NULL);
- g_list_free (priv->languages);
+ g_list_free_full (priv->books, g_object_unref);
+ g_list_free_full (priv->languages, (GDestroyNotify)dh_language_free);
/* Destroy the monitors HT */
if (priv->monitors) {
g_hash_table_destroy (priv->monitors);
}
- /* Clean the list of books disabled */
- for (sl = priv->books_disabled; sl; sl = g_slist_next (sl)) {
- g_free (sl->data);
- }
- g_slist_free (priv->books_disabled);
+ g_slist_free_full (priv->books_disabled, g_free);
g_clear_object (&priv->settings);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]