[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_1_1_1-77-g191a3dd

Philippe Delorme nobody at users.sourceforge.net
Sat Jan 19 22:29:12 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  191a3ddc55e3533e72a4d441fee2dab1c7302258 (commit)
      from  5d451888a8109432cd079e7f8d3494632b5b47a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 191a3ddc55e3533e72a4d441fee2dab1c7302258
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Sat Jan 19 22:25:34 2013 +0100

    Simplify GSList freeing code - first stage
    
    Requirement is now 2.28 which means we can used the dedicated
    function g_slist_free_full to clean lists of non-trivial structs.

-----------------------------------------------------------------------

Changes:
diff --git a/src/export.c b/src/export.c
index 38f9165..962b625 100644
--- a/src/export.c
+++ b/src/export.c
@@ -148,9 +148,8 @@ void export_accounts ( void )
 
     g_free ( extension );
     g_slist_free ( selected_accounts );
-    g_slist_foreach ( exported_accounts, ( GFunc ) expert_account_free_account_structure, NULL );
-    g_slist_free ( exported_accounts );
-/*     g_slist_free_full ( exported_accounts, ( GDestroyNotify ) expert_account_free_account_structure );  */
+    g_slist_free_full ( exported_accounts, ( GDestroyNotify ) expert_account_free_account_structure );
+
     gtk_widget_destroy ( dialog );
 }
 
diff --git a/src/gsb_data_account.c b/src/gsb_data_account.c
index b1e4f46..3a75a01 100644
--- a/src/gsb_data_account.c
+++ b/src/gsb_data_account.c
@@ -174,17 +174,10 @@ void gsb_data_account_delete_all_accounts (void)
 {
     if ( list_accounts )
     {
-        GSList* tmp_list = list_accounts;
-        while ( tmp_list )
-        {
-	    struct_account *account;
-	    account = tmp_list -> data;
-	    tmp_list = tmp_list -> next;
-            _gsb_data_account_free ( account );
-	}
-        g_slist_free ( list_accounts );
+        g_slist_free_full ( list_accounts, (GDestroyNotify) _gsb_data_account_free );
+        list_accounts = NULL;
     }
-    list_accounts = NULL;
+
     account_buffer = NULL;
 }
 
diff --git a/src/gsb_data_archive.c b/src/gsb_data_archive.c
index abbc850..da2243e 100644
--- a/src/gsb_data_archive.c
+++ b/src/gsb_data_archive.c
@@ -93,17 +93,10 @@ gboolean gsb_data_archive_init_variables ( void )
 {
     if ( archive_list )
     {
-        GSList* tmp_list = archive_list;
-        while ( tmp_list )
-        {
-	    struct_archive *archive;
-	    archive = tmp_list -> data;
-	    tmp_list = tmp_list -> next;
-            _gsb_data_archive_free ( archive );
-	}
-        g_slist_free ( archive_list );
+        g_slist_free_full ( archive_list, (GDestroyNotify) _gsb_data_archive_free );
+        archive_list = NULL;
     }
-    archive_list = NULL;
+
     archive_buffer = NULL;
 
     return FALSE;
diff --git a/src/gsb_data_bank.c b/src/gsb_data_bank.c
index f3bd8d6..188a685 100644
--- a/src/gsb_data_bank.c
+++ b/src/gsb_data_bank.c
@@ -101,17 +101,10 @@ gboolean gsb_data_bank_init_variables ( void )
 {
     if ( bank_list )
     {
-        GSList* tmp_list = bank_list;
-        while ( tmp_list )
-        {
-	    struct_bank *bank;
-	    bank = tmp_list -> data;
-	    tmp_list = tmp_list -> next;
-	    _gsb_data_bank_free ( bank );
-        }
-        g_slist_free ( bank_list );
+        g_slist_free_full ( bank_list, (GDestroyNotify) _gsb_data_bank_free );
+        bank_list = NULL;
     }
-    bank_list = NULL;
+
     bank_buffer = NULL;
 
     return FALSE;
@@ -250,6 +243,7 @@ static void _gsb_data_bank_free ( struct_bank* bank)
     if ( !bank )
 	return;
 
+    printf ( "Free bank %s\n", bank -> bank_name );
     /* free string fields */
     g_free ( bank -> bank_name );
     g_free ( bank -> bank_code );
diff --git a/src/gsb_data_budget.c b/src/gsb_data_budget.c
index 7d89206..97f8725 100644
--- a/src/gsb_data_budget.c
+++ b/src/gsb_data_budget.c
@@ -134,18 +134,9 @@ gboolean gsb_data_budget_init_variables ( void )
 {
     if ( budget_list )
     {
-        /* free memory used by the budget list */
-        GSList *tmp_list = budget_list;
-        while ( tmp_list )
-        {
-            struct_budget *budget;
-            budget = tmp_list -> data;
-            tmp_list = tmp_list -> next;
-	    _gsb_data_budget_free ( budget );
-        }
-	g_slist_free (budget_list);
+        g_slist_free_full ( budget_list, (GDestroyNotify) _gsb_data_budget_free );
+        budget_list = NULL;
     }
-    budget_list = NULL;
 
     /* recreate the empty budget */
     _gsb_data_budget_free ( empty_budget );
@@ -167,24 +158,15 @@ static void _gsb_data_budget_free ( struct_budget* budget )
 {
     if ( ! budget )
         return;
+
     /* free memory used by sub-bugdgets */
     if ( budget -> sub_budget_list)
-    {
-        GSList* sub_tmp_list = budget -> sub_budget_list;
-        while ( sub_tmp_list )
-        {
-	    struct_sub_budget *sub_budget;
-	    sub_budget = sub_tmp_list -> data;
-	    sub_tmp_list = sub_tmp_list -> next;
-	    _gsb_data_sub_budget_free ( sub_budget );
-        }
-	g_slist_free ( budget -> sub_budget_list );
-    }
-    if ( budget -> budget_name )
-	g_free ( budget -> budget_name);
+        g_slist_free_full ( budget -> sub_budget_list, (GDestroyNotify) _gsb_data_sub_budget_free );
+    g_free ( budget -> budget_name);
     g_free ( budget );
+
     if ( budget_buffer == budget )
-	budget_buffer = NULL;
+        budget_buffer = NULL;
 }
 
 /**


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list