[grisbi-cvs] grisbi/src gsb_data_account.c,1.80,1.81

Mickaƫl Remars mykeul at users.sourceforge.net
Sat Jun 6 18:02:55 CEST 2009


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

Modified Files:
	gsb_data_account.c 
Log Message:
avoid some more crashes when saving on win32

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- gsb_data_account.c	6 Jun 2009 15:14:14 -0000	1.80
+++ gsb_data_account.c	6 Jun 2009 16:02:53 -0000	1.81
@@ -633,10 +633,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;
 }
@@ -751,13 +749,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;
 }
@@ -1445,8 +1438,7 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> bank_branch_code )
-        g_free ( account -> bank_branch_code );
+    g_free ( account -> bank_branch_code );
 	account -> bank_branch_code = g_strdup ( bank_branch_code ? bank_branch_code : "" );
 
     return TRUE;
@@ -1489,8 +1481,7 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> bank_account_number )
-        g_free ( account -> bank_account_number );
+    g_free ( account -> bank_account_number );
 	account -> bank_account_number = g_strdup ( bank_account_number ? bank_account_number : "" );
 
     return TRUE;
@@ -1534,8 +1525,7 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> bank_account_key )
-        g_free ( account -> bank_account_key );
+    g_free ( account -> bank_account_key );
 	account -> bank_account_key = g_strdup ( bank_account_key ? bank_account_key : "" );
 
     return TRUE;
@@ -1616,8 +1606,7 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> comment )
-        g_free ( account -> comment );
+    g_free ( account -> comment );
     account -> comment = g_strdup ( comment ? comment : "" );
 
     return TRUE;
@@ -1873,8 +1862,7 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> holder_name )
-        g_free ( account -> holder_name );
+    g_free ( account -> holder_name );
 	account -> holder_name = g_strdup ( holder_name ? holder_name : "" );
 
     return TRUE;
@@ -1917,8 +1905,7 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> holder_address )
-        g_free ( account -> holder_address );
+    g_free ( account -> holder_address );
 	account -> holder_address = g_strdup ( holder_address ? holder_address : "" );
 
     return TRUE;
@@ -2442,13 +2429,8 @@
     if (!account )
     return FALSE;
 
-    if ( account -> name_icon )
-        g_free ( account -> name_icon );
-
-    if (!filename || !strlen (filename))
-    account -> name_icon = NULL;
-    else
-    account -> name_icon = my_strdup (filename);
+    g_free ( account -> name_icon );
+    account -> name_icon = g_strdup ( filename ? filename : "" );
 
     return TRUE;
 }
@@ -2642,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