[grisbi-cvs] grisbi/src gsb_data_account.c,1.82,1.83

Pierre Biava pbiava at users.sourceforge.net
Sun Jun 7 23:35:33 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26247

Modified Files:
	gsb_data_account.c 
Log Message:
correcting bad update file before modification

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- gsb_data_account.c	7 Jun 2009 07:31:42 -0000	1.82
+++ gsb_data_account.c	7 Jun 2009 21:35:31 -0000	1.83
@@ -216,9 +216,19 @@
 
     /* set the base */
     account -> account_number = last_number + 1;
+    account -> account_id = g_strdup("");
     account -> account_name = g_strdup_printf ( _("No name %d"),
 						account -> account_number );
     account -> currency = gsb_data_currency_get_default_currency ();
+    account -> name_icon = g_strdup("");
+    account -> comment = g_strdup("");
+    account -> holder_name = g_strdup("");
+    account -> holder_address = g_strdup("");
+
+    account -> bank_branch_code = g_strdup("");
+    account -> bank_account_number = g_strdup("");
+    account -> bank_account_key = g_strdup("");
+    account -> bank_account_iban = g_strdup("");
 
     /* set the kind of account */
     account -> account_kind = account_kind;
@@ -622,10 +632,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> account_id )
-        g_free ( account -> account_id );
-
-    account -> account_id = my_strdup (id);
+    g_free ( account -> account_id );
+    account -> account_id = g_strdup ( id ? id : "" );
 
     return TRUE;
 }
@@ -740,13 +748,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> account_name )
-        g_free ( account -> account_name );
-
-    if (!name || !strlen (name))
-	account -> account_name = NULL;
-    else
-	account -> account_name = my_strdup (name);
+    g_free ( account -> account_name );
+	account -> account_name = g_strdup ( name ? name : "" );
 
     return TRUE;
 }
@@ -1434,13 +1437,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> bank_branch_code )
-        g_free ( account -> bank_branch_code );
-
-    if (!bank_branch_code || !strlen (bank_branch_code))
-	account -> bank_branch_code = NULL;
-    else
-	account -> bank_branch_code = my_strdup (bank_branch_code);
+    g_free ( account -> bank_branch_code );
+	account -> bank_branch_code = g_strdup ( bank_branch_code ? bank_branch_code : "" );
 
     return TRUE;
 }
@@ -1482,13 +1480,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> bank_account_number )
-        g_free ( account -> bank_account_number );
-
-    if (!bank_account_number || !strlen (bank_account_number))
-	account -> bank_account_number = NULL;
-    else
-	account -> bank_account_number = my_strdup (bank_account_number);
+    g_free ( account -> bank_account_number );
+	account -> bank_account_number = g_strdup ( bank_account_number ? bank_account_number : "" );
 
     return TRUE;
 }
@@ -1531,13 +1524,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> bank_account_key )
-        g_free ( account -> bank_account_key );
-
-    if (!bank_account_key || !strlen (bank_account_key))
-	account -> bank_account_key = NULL;
-    else
-	account -> bank_account_key = my_strdup (bank_account_key);
+    g_free ( account -> bank_account_key );
+	account -> bank_account_key = g_strdup ( bank_account_key ? bank_account_key : "" );
 
     return TRUE;
 }
@@ -1617,9 +1605,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> comment )
-        g_free ( account -> comment );
-    account -> comment = my_strdup (comment);
+    g_free ( account -> comment );
+    account -> comment = g_strdup ( comment ? comment : "" );
 
     return TRUE;
 }
@@ -1874,13 +1861,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> holder_name )
-        g_free ( account -> holder_name );
-
-    if (!holder_name || !strlen (holder_name))
-	account -> holder_name = NULL;
-    else
-	account -> holder_name = my_strdup (holder_name);
+    g_free ( account -> holder_name );
+	account -> holder_name = g_strdup ( holder_name ? holder_name : "" );
 
     return TRUE;
 }
@@ -1922,13 +1904,8 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> holder_address )
-        g_free ( account -> holder_address );
-
-    if (!holder_address || !strlen (holder_address))
-	account -> holder_address = NULL;
-    else
-	account -> holder_address = my_strdup (holder_address);
+    g_free ( account -> holder_address );
+	account -> holder_address = g_strdup ( holder_address ? holder_address : "" );
 
     return TRUE;
 }
@@ -2451,9 +2428,7 @@
     if (!account )
     return FALSE;
 
-    if ( account -> name_icon && strlen ( account -> name_icon ) )
-        g_free ( account -> name_icon );
-
+    g_free ( account -> name_icon );
     account -> name_icon = g_strdup ( filename ? filename : "" );
 
     return TRUE;
@@ -2649,13 +2624,8 @@
     if (!account )
         return FALSE;
     
-    if ( account -> bank_account_iban )
-        g_free ( account -> bank_account_iban );
-
-    if (!iban || !strlen (iban))
-        account -> bank_account_iban = NULL;
-    else
-        account -> bank_account_iban = my_strdup ( iban );
+    g_free ( account -> bank_account_iban );
+    account -> bank_account_iban = g_strdup ( iban ? iban : "" );
 
     return TRUE;
 }



More information about the cvs mailing list