[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_1_1_1-75-g7864617

Philippe Delorme nobody at users.sourceforge.net
Sat Jan 19 16:40:48 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  78646179506933617ab0c9aff5327b66c39bd426 (commit)
       via  a9a0e6b8a7c82448f04ade1227c900368ee547f6 (commit)
      from  2131feccad22cd6105c0c9bd880939db6114af45 (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 78646179506933617ab0c9aff5327b66c39bd426
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Sat Jan 19 16:35:36 2013 +0100

    Improve readability

commit a9a0e6b8a7c82448f04ade1227c900368ee547f6
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Sat Jan 19 16:13:27 2013 +0100

    Fixed some memory leaks

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

Changes:
diff --git a/src/accueil.c b/src/accueil.c
index 5936e1d..26b4eb2 100644
--- a/src/accueil.c
+++ b/src/accueil.c
@@ -786,24 +786,21 @@ static void update_liste_comptes_accueil ( gboolean force )
         while ( list_tmp )
         {
             kind_account i;
-
             i = gsb_data_partial_balance_get_number ( list_tmp -> data );
 
-            if ( gsb_data_partial_balance_get_kind ( i ) == GSB_TYPE_ASSET )
-            {
-                new_comptes_actif++;
-            }
-            else if ( gsb_data_partial_balance_get_kind ( i ) == GSB_TYPE_LIABILITIES )
+            switch ( gsb_data_partial_balance_get_kind ( i ) )
             {
-                new_comptes_passif++;
-            }
-            else if ( gsb_data_partial_balance_get_kind ( i ) == -1 )
-            {
-                soldes_mixtes++;
-            }
-            else
-            {
-                new_comptes_bancaires++;
+                case GSB_TYPE_ASSET:
+                    new_comptes_actif++; break;
+
+                case GSB_TYPE_LIABILITIES:
+                    new_comptes_passif++; break;
+
+                case -1:
+                    soldes_mixtes++; break;
+
+                default:
+                    new_comptes_bancaires++;
             }
             list_tmp = list_tmp -> next;
         }
@@ -2155,7 +2152,8 @@ gboolean gsb_main_page_update_finished_scheduled_transactions ( gint scheduled_n
     GtkWidget *hbox;
     gint account_number;
     gint currency_number;
-	gchar *tmp_str;
+    gsb_real amount;
+	gchar *tmp_str, *tmp_str2, *way;
 
     account_number = gsb_data_scheduled_get_account_number ( scheduled_number );
     currency_number = gsb_data_scheduled_get_currency_number ( scheduled_number) ;
@@ -2180,37 +2178,25 @@ gboolean gsb_main_page_update_finished_scheduled_transactions ( gint scheduled_n
     gtk_widget_show ( label  );
 
     /* label à droite */
-    if ( gsb_data_scheduled_get_amount (scheduled_number).mantissa >= 0 )
+    amount = gsb_data_scheduled_get_amount ( scheduled_number );
+    
+    if ( amount.mantissa >= 0 )
     {
-        gchar* tmp_str2;
-
-        tmp_str2 = utils_real_get_string_with_currency ( gsb_data_scheduled_get_amount (
-                        scheduled_number ),
-                        currency_number,
-                        TRUE );
-            tmp_str = g_strdup_printf ( _("%s credited on %s"),
-                        tmp_str2,
-                        gsb_data_account_get_name ( account_number ) );
-
-        g_free ( tmp_str2 );
+        amount = gsb_real_abs ( amount );
+        way = _("%s credited on %s");
     }
     else
     {
-        gchar* tmp_str2;
-
-        tmp_str2 = utils_real_get_string_with_currency ( gsb_real_abs (
-                        gsb_data_scheduled_get_amount ( scheduled_number ) ),
-                        currency_number,
-                        TRUE );
-        tmp_str = g_strdup_printf ( _("%s debited on %s"),
-                        tmp_str2,
-                        gsb_data_account_get_name ( account_number ) );
-
-        g_free ( tmp_str2 );
+        way = _("%s debited on %s");
     }
 
+    tmp_str2 = utils_real_get_string_with_currency ( amount, currency_number, TRUE );
+    tmp_str = g_strdup_printf ( way, tmp_str2, gsb_data_account_get_name ( account_number ) );
+    g_free ( tmp_str2 );
+
     label = gtk_label_new ( tmp_str );
     g_free ( tmp_str );
+
     gtk_misc_set_alignment ( GTK_MISC ( label ), MISC_RIGHT, MISC_VERT_CENTER );
     gtk_box_pack_end ( GTK_BOX (hbox), label, FALSE, TRUE, 0 );
     gtk_widget_show (  label );
diff --git a/src/gsb_data_account.c b/src/gsb_data_account.c
index b1e4f46..7816d9d 100644
--- a/src/gsb_data_account.c
+++ b/src/gsb_data_account.c
@@ -2834,8 +2834,8 @@ void gsb_data_account_colorize_current_balance ( gint account_number )
     if ( gsb_data_account_get_current_balance (account_number).mantissa < 0 )
     {
         string = g_strdup_printf ( "<span color=\"red\">%s</span>", tmpstr );
-        g_free ( tmpstr );
     }
+    g_free ( tmpstr );
 
     if ( !string )
         string = g_strdup ( "" );
diff --git a/src/gsb_data_reconcile.c b/src/gsb_data_reconcile.c
index 85fa8f7..ec3907e 100644
--- a/src/gsb_data_reconcile.c
+++ b/src/gsb_data_reconcile.c
@@ -243,8 +243,7 @@ static void _gsb_data_reconcile_free ( struct_reconcile *reconcile )
 {
     if ( ! reconcile )
         return;
-    if ( reconcile -> reconcile_name )
-        g_free ( reconcile -> reconcile_name );
+    g_free ( reconcile -> reconcile_name );
     if ( reconcile -> reconcile_init_date)
         g_date_free ( reconcile -> reconcile_init_date );
     if ( reconcile -> reconcile_final_date)
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index 221042e..736ebb1 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -3350,12 +3350,9 @@ void gsb_file_load_financial_year ( const gchar **attribute_names,
                "Bdte" ))
     {
         date = gsb_parse_date_string_safe (attribute_values[i]);
-        gsb_data_fyear_set_beginning_date ( fyear_number,
-                           date );
+        gsb_data_fyear_set_beginning_date ( fyear_number, date );
         if ( date )
-        {
-        g_date_free (date);
-        }
+            g_date_free (date);
         i++;
         continue;
     }
@@ -3364,12 +3361,9 @@ void gsb_file_load_financial_year ( const gchar **attribute_names,
                "Edte" ))
     {
         date = gsb_parse_date_string_safe (attribute_values[i]);
-        gsb_data_fyear_set_end_date ( fyear_number,
-                      date );
+        gsb_data_fyear_set_end_date ( fyear_number, date );
         if ( date )
-        {
-        g_date_free (date);
-        }
+            g_date_free (date);
         i++;
         continue;
     }
@@ -3500,6 +3494,7 @@ void gsb_file_load_reconcile ( const gchar **attribute_names,
 {
     gint i=0;
     gint reconcile_number = 0;
+    GDate *date;
 
     if ( !attribute_names[i] )
     return;
@@ -3547,18 +3542,20 @@ void gsb_file_load_reconcile ( const gchar **attribute_names,
     if ( !strcmp ( attribute_names[i],
                "Idate" ))
     {
-        gsb_data_reconcile_set_init_date ( reconcile_number,
-                           gsb_parse_date_string_safe (attribute_values[i]));
+        date = gsb_parse_date_string_safe ( attribute_values[i] );
+        gsb_data_reconcile_set_init_date ( reconcile_number, date );
         i++;
+        g_date_free ( date );
         continue;
     }
 
     if ( !strcmp ( attribute_names[i],
                "Fdate" ))
     {
-        gsb_data_reconcile_set_final_date ( reconcile_number,
-                            gsb_parse_date_string_safe (attribute_values[i]));
+        date = gsb_parse_date_string_safe ( attribute_values[i] );
+        gsb_data_reconcile_set_final_date ( reconcile_number, date );
         i++;
+        g_date_free ( date );
         continue;
     }
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list