[grisbi-cvs] grisbi/src gsb_data_account.c, 1.84, 1.85 gsb_data_bank.c, 1.12, 1.13 gsb_data_payee.c, 1.48, 1.49 gsb_data_report.c, 1.31, 1.32 gsb_data_report_text_comparison.c, 1.15, 1.16 gsb_data_scheduled.c, 1.28, 1.29 gsb_data_transaction.c, 1.63, 1.64 gsb_file_save.c, 1.129, 1.130 gsb_transactions_list.c, 1.167, 1.168
Mickaël Remars
mykeul at users.sourceforge.net
Wed Jun 10 22:14:57 CEST 2009
Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25468
Modified Files:
gsb_data_account.c gsb_data_bank.c gsb_data_payee.c
gsb_data_report.c gsb_data_report_text_comparison.c
gsb_data_scheduled.c gsb_data_transaction.c gsb_file_save.c
gsb_transactions_list.c
Log Message:
Reverted most of my changes commited on 2009-06-06 as they have too many side effects. The saving issues on win32 are back for now.
Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- gsb_data_transaction.c 6 Jun 2009 15:14:14 -0000 1.63
+++ gsb_data_transaction.c 10 Jun 2009 20:14:55 -0000 1.64
@@ -414,8 +414,11 @@
if ( transaction -> transaction_id )
g_free ( transaction -> transaction_id );
- transaction -> transaction_id = g_strdup ( transaction_id ? transaction_id : "" );
+ if (transaction_id)
+ transaction -> transaction_id = my_strdup (transaction_id);
+ else
+ transaction -> transaction_id = NULL;
return TRUE;
}
@@ -1268,7 +1271,13 @@
if ( transaction -> notes )
g_free ( transaction -> notes );
- transaction -> notes = g_strdup ( notes ? notes : "" );
+
+ if ( notes
+ &&
+ strlen (notes))
+ transaction -> notes = my_strdup (notes);
+ else
+ transaction -> notes = NULL;
return TRUE;
}
@@ -1373,7 +1382,13 @@
if ( transaction -> method_of_payment_content )
g_free ( transaction -> method_of_payment_content );
- transaction -> method_of_payment_content = g_strdup ( method_of_payment_content ? method_of_payment_content : "" );
+
+ if ( method_of_payment_content
+ &&
+ strlen (method_of_payment_content))
+ transaction -> method_of_payment_content = my_strdup (method_of_payment_content);
+ else
+ transaction -> method_of_payment_content = NULL;
return TRUE;
}
@@ -1819,7 +1834,13 @@
if ( transaction -> bank_references )
g_free ( transaction -> bank_references );
- transaction -> bank_references = g_strdup ( bank_references ? bank_references : "" );
+
+ if ( bank_references
+ &&
+ strlen (bank_references))
+ transaction -> bank_references = my_strdup (bank_references);
+ else
+ transaction -> bank_references = NULL;
return TRUE;
}
@@ -1970,13 +1991,10 @@
transaction_number = gsb_data_transaction_get_last_number () + 1;
transaction -> account_number = no_account;
- transaction -> transaction_id = g_strdup("");
transaction -> transaction_number = transaction_number;
transaction -> currency_number = gsb_data_account_get_currency (no_account);
- transaction -> notes = g_strdup("");
transaction -> voucher = g_strdup("");
transaction -> bank_references = g_strdup("");
- transaction -> method_of_payment_content = g_strdup("");
/* we append the transaction to the complete transactions list and the non archive transaction list */
transactions_list = g_slist_append ( transactions_list,
Index: gsb_data_payee.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_payee.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- gsb_data_payee.c 6 Jun 2009 15:14:14 -0000 1.48
+++ gsb_data_payee.c 10 Jun 2009 20:14:55 -0000 1.49
@@ -572,7 +572,12 @@
/* we free the last name */
if ( payee -> payee_description )
g_free (payee -> payee_description);
- payee -> payee_description = g_strdup ( description ? description : "" );
+
+ /* and copy the new one */
+ if (description)
+ payee -> payee_description = my_strdup (description);
+ else
+ payee -> payee_description = NULL;
return TRUE;
}
@@ -841,7 +846,12 @@
/* we free the last name */
if ( payee -> payee_search_string )
g_free (payee -> payee_search_string);
- payee -> payee_search_string = g_strdup ( search_string ? search_string : "" );
+
+ /* and copy the new one */
+ if (search_string)
+ payee -> payee_search_string = my_strdup (search_string);
+ else
+ payee -> payee_search_string = NULL;
return TRUE;
}
Index: gsb_data_bank.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_bank.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gsb_data_bank.c 7 Jun 2009 22:18:31 -0000 1.12
+++ gsb_data_bank.c 10 Jun 2009 20:14:55 -0000 1.13
@@ -217,20 +217,9 @@
bank = g_malloc0 ( sizeof ( struct_bank ));
bank -> bank_number = gsb_data_bank_max_number () + 1;
- bank -> bank_name = g_strdup(name ? name : "");
- bank -> bank_code = g_strdup("");
- bank -> bank_BIC = g_strdup("");
-
- bank -> bank_address = g_strdup("");
- bank -> bank_tel = g_strdup("");
- bank -> bank_mail = g_strdup("");
- bank -> bank_web = g_strdup("");
- bank -> bank_note = g_strdup("");
- bank -> correspondent_name = g_strdup("");
- bank -> correspondent_tel = g_strdup("");
- bank -> correspondent_mail = g_strdup("");
- bank -> correspondent_fax = g_strdup("");
+ if (name)
+ bank -> bank_name = my_strdup (name);
bank_list = g_slist_append ( bank_list, bank );
@@ -375,7 +364,7 @@
g_free (bank -> bank_name);
/* and copy the new one */
- bank -> bank_name = g_strdup ( name ? name : "" );
+ bank -> bank_name = my_strdup (name);
return TRUE;
}
@@ -425,7 +414,7 @@
g_free (bank -> bank_code);
/* and copy the new one */
- bank -> bank_code = g_strdup ( bank_code ? bank_code : "" );
+ bank -> bank_code = my_strdup (bank_code);
return TRUE;
}
@@ -476,7 +465,7 @@
g_free (bank -> bank_address);
/* and copy the new one */
- bank -> bank_address = g_strdup ( bank_address ? bank_address : "" );
+ bank -> bank_address = my_strdup (bank_address);
return TRUE;
}
@@ -525,7 +514,7 @@
g_free (bank -> bank_tel);
/* and copy the new one */
- bank -> bank_tel = g_strdup ( bank_tel ? bank_tel : "" );
+ bank -> bank_tel = my_strdup (bank_tel);
return TRUE;
}
@@ -575,7 +564,7 @@
g_free (bank -> bank_mail);
/* and copy the new one */
- bank -> bank_mail = g_strdup ( bank_mail ? bank_mail : "" );
+ bank -> bank_mail = my_strdup (bank_mail);
return TRUE;
}
@@ -625,7 +614,7 @@
g_free (bank -> bank_web);
/* and copy the new one */
- bank -> bank_web = g_strdup ( bank_web ? bank_web : "" );
+ bank -> bank_web = my_strdup (bank_web);
return TRUE;
}
@@ -675,7 +664,7 @@
g_free (bank -> bank_note);
/* and copy the new one */
- bank -> bank_note = g_strdup ( bank_note ? bank_note : "" );
+ bank -> bank_note = my_strdup (bank_note);
return TRUE;
}
@@ -725,7 +714,7 @@
g_free (bank -> correspondent_name);
/* and copy the new one */
- bank -> correspondent_name = g_strdup ( correspondent_name ? correspondent_name : "" );
+ bank -> correspondent_name = my_strdup (correspondent_name);
return TRUE;
}
@@ -775,7 +764,7 @@
g_free (bank -> correspondent_tel);
/* and copy the new one */
- bank -> correspondent_tel = g_strdup ( correspondent_tel ? correspondent_tel : "" );
+ bank -> correspondent_tel = my_strdup (correspondent_tel);
return TRUE;
}
@@ -825,7 +814,7 @@
g_free (bank -> correspondent_mail);
/* and copy the new one */
- bank -> correspondent_mail = g_strdup ( correspondent_mail ? correspondent_mail : "" );
+ bank -> correspondent_mail = my_strdup (correspondent_mail);
return TRUE;
}
@@ -875,7 +864,7 @@
g_free (bank -> correspondent_fax);
/* and copy the new one */
- bank -> correspondent_fax = g_strdup ( correspondent_fax ? correspondent_fax : "" );
+ bank -> correspondent_fax = my_strdup (correspondent_fax);
return TRUE;
}
@@ -924,7 +913,7 @@
g_free (bank -> bank_BIC);
/* and copy the new one */
- bank -> bank_BIC = g_strdup ( bank_BIC ? bank_BIC : "" );
+ bank -> bank_BIC = my_strdup (bank_BIC);
return TRUE;
}
Index: gsb_data_scheduled.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_scheduled.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gsb_data_scheduled.c 7 Jun 2009 22:18:31 -0000 1.28
+++ gsb_data_scheduled.c 10 Jun 2009 20:14:55 -0000 1.29
@@ -802,7 +802,13 @@
if ( scheduled -> notes )
g_free ( scheduled -> notes );
- scheduled -> notes = g_strdup ( notes ? notes : "" );
+
+ if ( notes
+ &&
+ strlen (notes))
+ scheduled -> notes = my_strdup (notes);
+ else
+ scheduled -> notes = NULL;
return TRUE;
}
@@ -913,7 +919,13 @@
if ( scheduled -> method_of_payment_content )
g_free ( scheduled -> method_of_payment_content );
- scheduled -> method_of_payment_content = g_strdup ( method_of_payment_content ? method_of_payment_content : "" );
+
+ if ( method_of_payment_content
+ &&
+ strlen (method_of_payment_content))
+ scheduled -> method_of_payment_content = my_strdup (method_of_payment_content);
+ else
+ scheduled -> method_of_payment_content = NULL;
return TRUE;
}
Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- gsb_transactions_list.c 6 Jun 2009 15:44:31 -0000 1.167
+++ gsb_transactions_list.c 10 Jun 2009 20:14:55 -0000 1.168
@@ -809,10 +809,14 @@
/* mise en place du no de chèque/virement */
case ELEMENT_CHQ:
- {
- const gchar *value = gsb_data_transaction_get_method_of_payment_content ( transaction_number );
- return ( value && *value ) ? g_strconcat ( "(", value, ")", NULL ) : NULL;
- }
+ if ( gsb_data_transaction_get_method_of_payment_content ( transaction_number))
+ return ( g_strconcat ( "(",
+ gsb_data_transaction_get_method_of_payment_content ( transaction_number),
+ ")",
+ NULL ));
+ else
+ return ( NULL );
+ break;
}
return ( NULL );
}
Index: gsb_data_report_text_comparison.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_report_text_comparison.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- gsb_data_report_text_comparison.c 7 Jun 2009 22:18:31 -0000 1.15
+++ gsb_data_report_text_comparison.c 10 Jun 2009 20:14:55 -0000 1.16
@@ -299,7 +299,7 @@
text_comparison -> field = last_text_comparison -> field;
text_comparison -> operator = last_text_comparison -> operator;
if (last_text_comparison -> text)
- text_comparison -> text = g_strdup (last_text_comparison -> text ? last_text_comparison -> text : "");
+ text_comparison -> text = my_strdup (last_text_comparison -> text);
text_comparison -> use_text = last_text_comparison -> use_text;
text_comparison -> first_comparison = last_text_comparison -> first_comparison;
text_comparison -> first_amount = last_text_comparison -> first_amount;
@@ -502,8 +502,10 @@
if ( !text_comparison )
return FALSE;
- g_free(text_comparison -> text);
- text_comparison -> text = g_strdup (text ? text : "");
+ if ( text && strlen (text))
+ text_comparison -> text = my_strdup (text);
+ else
+ text_comparison -> text = NULL;
return TRUE;
}
Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- gsb_data_account.c 9 Jun 2009 21:19:30 -0000 1.84
+++ gsb_data_account.c 10 Jun 2009 20:14:55 -0000 1.85
@@ -216,19 +216,9 @@
/* 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;
@@ -632,8 +622,10 @@
if (!account )
return FALSE;
- g_free ( account -> account_id );
- account -> account_id = g_strdup ( id ? id : "" );
+ if ( account -> account_id )
+ g_free ( account -> account_id );
+
+ account -> account_id = my_strdup (id);
return TRUE;
}
@@ -748,8 +740,13 @@
if (!account )
return FALSE;
- g_free ( account -> account_name );
- account -> account_name = g_strdup ( name ? name : "" );
+ if ( account -> account_name )
+ g_free ( account -> account_name );
+
+ if (!name || !strlen (name))
+ account -> account_name = NULL;
+ else
+ account -> account_name = my_strdup (name);
return TRUE;
}
@@ -1437,8 +1434,13 @@
if (!account )
return FALSE;
- g_free ( account -> bank_branch_code );
- account -> bank_branch_code = g_strdup ( bank_branch_code ? bank_branch_code : "" );
+ 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);
return TRUE;
}
@@ -1480,8 +1482,13 @@
if (!account )
return FALSE;
- g_free ( account -> bank_account_number );
- account -> bank_account_number = g_strdup ( bank_account_number ? bank_account_number : "" );
+ 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);
return TRUE;
}
@@ -1524,8 +1531,13 @@
if (!account )
return FALSE;
- g_free ( account -> bank_account_key );
- account -> bank_account_key = g_strdup ( bank_account_key ? bank_account_key : "" );
+ 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);
return TRUE;
}
@@ -1605,8 +1617,9 @@
if (!account )
return FALSE;
- g_free ( account -> comment );
- account -> comment = g_strdup ( comment ? comment : "" );
+ if ( account -> comment )
+ g_free ( account -> comment );
+ account -> comment = my_strdup (comment);
return TRUE;
}
@@ -1861,8 +1874,13 @@
if (!account )
return FALSE;
- g_free ( account -> holder_name );
- account -> holder_name = g_strdup ( holder_name ? holder_name : "" );
+ 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);
return TRUE;
}
@@ -1904,8 +1922,13 @@
if (!account )
return FALSE;
- g_free ( account -> holder_address );
- account -> holder_address = g_strdup ( holder_address ? holder_address : "" );
+ 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);
return TRUE;
}
@@ -2428,8 +2451,13 @@
if (!account )
return FALSE;
- g_free ( account -> name_icon );
- account -> name_icon = g_strdup ( filename ? filename : "" );
+ if ( account -> name_icon )
+ g_free ( account -> name_icon );
+
+ if (!filename || !strlen (filename))
+ account -> name_icon = NULL;
+ else
+ account -> name_icon = my_strdup (filename);
return TRUE;
}
@@ -2624,8 +2652,13 @@
if (!account )
return FALSE;
- g_free ( account -> bank_account_iban );
- account -> bank_account_iban = g_strdup ( iban ? iban : "" );
+ 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 );
return TRUE;
}
Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- gsb_file_save.c 7 Jun 2009 22:18:31 -0000 1.129
+++ gsb_file_save.c 10 Jun 2009 20:14:55 -0000 1.130
@@ -657,8 +657,8 @@
etat.crypt_file,
is_archive,
tmpstr,
- adresse_commune ? adresse_commune : "",
- adresse_secondaire ? adresse_secondaire : "",
+ adresse_commune,
+ adresse_secondaire,
no_devise_totaux_tiers,
no_devise_totaux_categ,
no_devise_totaux_ib,
@@ -686,7 +686,7 @@
etat.combofix_force_payee,
etat.combofix_force_category,
etat.automatic_separator,
- etat.csv_separator ? etat.csv_separator : "",
+ etat.csv_separator,
skipped_lines_string );
g_free (transactions_view);
@@ -1017,7 +1017,7 @@
gsb_data_account_get_default_credit (account_number),
gsb_data_account_get_reconcile_sort_type (account_number),
gsb_data_account_get_split_neutral_payment (account_number),
- sort_list ? sort_list : "",
+ sort_list,
gsb_data_account_get_sort_type (account_number),
gsb_data_account_get_sort_column (account_number),
sort_kind_column,
@@ -1160,7 +1160,7 @@
transaction_number,
gsb_data_transaction_get_transaction_id ( transaction_number),
date,
- value_date ? value_date : "",
+ value_date,
gsb_data_transaction_get_currency_number (transaction_number ),
amount,
gsb_data_transaction_get_change_between (transaction_number ),
@@ -1260,7 +1260,7 @@
gsb_data_scheduled_get_frequency ( scheduled_number),
gsb_data_scheduled_get_user_interval ( scheduled_number),
gsb_data_scheduled_get_user_entry ( scheduled_number),
- limit_date ? limit_date : "",
+ limit_date,
gsb_data_scheduled_get_split_of_scheduled ( scheduled_number),
gsb_data_scheduled_get_mother_scheduled_number ( scheduled_number));
@@ -2250,25 +2250,25 @@
gsb_data_report_get_report_can_click (report_number),
gsb_data_report_get_use_financial_year (report_number),
gsb_data_report_get_financial_year_type (report_number),
- financial_year_select ? financial_year_select : "",
+ financial_year_select,
gsb_data_report_get_date_type (report_number),
- date_start ? date_start : "",
- date_end ? date_end : "",
+ date_start,
+ date_end,
gsb_data_report_get_period_split (report_number),
gsb_data_report_get_period_split_type (report_number),
gsb_data_report_get_financial_year_split (report_number),
gsb_data_report_get_period_split_day (report_number),
gsb_data_report_get_account_use_chosen (report_number),
- account_selected ? account_selected : "",
+ account_selected,
gsb_data_report_get_account_group_reports (report_number),
gsb_data_report_get_account_show_amount (report_number),
gsb_data_report_get_account_show_name (report_number),
gsb_data_report_get_transfer_choice (report_number),
- transfer_selected_accounts ? transfer_selected_accounts : "",
+ transfer_selected_accounts,
gsb_data_report_get_transfer_reports_only (report_number),
gsb_data_report_get_category_used (report_number),
gsb_data_report_get_category_detail_used (report_number),
- categ_selected ? categ_selected : "",
+ categ_selected,
gsb_data_report_get_category_show_category_amount (report_number),
gsb_data_report_get_category_show_sub_category (report_number),
gsb_data_report_get_category_show_without_category (report_number),
@@ -2277,7 +2277,7 @@
gsb_data_report_get_category_show_name (report_number),
gsb_data_report_get_budget_used (report_number),
gsb_data_report_get_budget_detail_used (report_number),
- budget_selected ? budget_selected : "",
+ budget_selected,
gsb_data_report_get_budget_show_budget_amount (report_number),
gsb_data_report_get_budget_show_sub_budget (report_number),
gsb_data_report_get_budget_show_without_budget (report_number),
@@ -2286,14 +2286,14 @@
gsb_data_report_get_budget_show_name (report_number),
gsb_data_report_get_payee_used (report_number),
gsb_data_report_get_payee_detail_used (report_number),
- payee_selected ? payee_selected : "",
+ payee_selected,
gsb_data_report_get_payee_show_payee_amount (report_number),
gsb_data_report_get_payee_currency (report_number),
gsb_data_report_get_payee_show_name (report_number),
gsb_data_report_get_amount_comparison_currency (report_number),
gsb_data_report_get_amount_comparison_only_report_non_null (report_number),
gsb_data_report_get_method_of_payment_used (report_number),
- payment_method_list ? payment_method_list : "",
+ payment_method_list,
gsb_data_report_get_text_comparison_used (report_number),
gsb_data_report_get_amount_comparison_used (report_number));
Index: gsb_data_report.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_report.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- gsb_data_report.c 7 Jun 2009 22:18:31 -0000 1.31
+++ gsb_data_report.c 10 Jun 2009 20:14:55 -0000 1.32
@@ -512,8 +512,10 @@
if ( !report )
return FALSE;
- g_free (report -> report_name);
- report -> report_name = g_strdup ( report_name ? report_name : "" );
+ if (report_name)
+ report -> report_name = my_strdup (report_name);
+ else
+ report -> report_name = NULL;
return TRUE;
}
@@ -3933,7 +3935,7 @@
/* we had to duplicate the strings, dates and lists */
if( report -> report_name )
- new_report -> report_name = g_strdup ( report -> report_name ? report -> report_name : "" );
+ new_report -> report_name = my_strdup ( report -> report_name );
new_report -> financial_year_list = g_slist_copy ( report -> financial_year_list );
new_report -> sorting_type = g_slist_copy ( report -> sorting_type );
new_report -> account_numbers = g_slist_copy ( report -> account_numbers );
More information about the cvs
mailing list