rem: if ( DEBUG ) printf ( "gsb_file_save_save_file : %s\n", filename );
add: devel_debug ( g_strdup_printf ("gsb_file_save_save_file : %s", filename ));
context: gboolean gsb_file_save_save_file ( gchar *filename,				   gboolean compress ){    gint do_chmod;    FILE *grisbi_file;    gulong iterator;    gulong length_calculated;    gchar *file_content;    gint general_part;    gint account_part;    gint transaction_part;    gint party_part;    gint category_part;    gint budgetary_part;    gint currency_part;    gint bank_part;    gint financial_year_part;    gint reconcile_part;    gint report_part;    if ( DEBUG )	printf ( "gsb_file_save_save_file : %s\n",		 filename );    do_chmod = !g_file_test ( filename,			      G_FILE_TEST_EXISTS );    etat.en_train_de_sauvegarder = 1;    /* we begin to try to reserve enough memory to make the entire file     * if not enough, we will make it growth later     * the data below are about the memory to take for each part and for 1 of this part     * with that i think we will allocate enough memory in one time but not too much */    general_part = 900;    account_part = 1200;    transaction_part = 350;    party_part = 100;    category_part = 500;    budgetary_part = 500;    currency_part = 150;    bank_part = 300;    financial_year_part = 100;    reconcile_part = 50;    report_part = 2500;        length_calculated = general_part	+ account_part * gsb_data_account_get_accounts_amount ()	+ transaction_part * g_slist_length ( gsb_data_transaction_get_transactions_list ())	+ party_part * g_slist_length ( gsb_data_payee_get_payees_list ())	+ category_part * g_slist_length ( gsb_data_category_get_categories_list ())	+ budgetary_part * g_slist_length ( gsb_data_budget_get_budgets_list ())	+ currency_part * g_slist_length ( liste_struct_devises )	+ bank_part * g_slist_length ( liste_struct_banques )	+ financial_year_part * g_slist_length (liste_struct_exercices  )	+ reconcile_part * g_slist_length ( liste_struct_rapprochements )	+ report_part * g_slist_length ( gsb_data_report_get_report_list ());    iterator = 0;    file_content = g_malloc ( length_calculated );    /* begin the file whit xml markup */        iterator = gsb_file_save_append_part ( iterator,					   &length_calculated,					   &file_content,					   g_strdup ("<?xml version=\"1.0\"?>\n<Grisbi>\n"));    iterator = gsb_file_save_general_part ( iterator,					    &length_calculated,					    &file_content );    iterator = gsb_file_save_account_part ( iterator,					    &length_calculated,					    &file_content );    iterator = gsb_file_save_payment_part ( iterator,					    &length_calculated,					    &file_content );    iterator = gsb_file_save_transaction_part ( iterator,						&length_calculated,						&file_content );    iterator = gsb_file_save_scheduled_part ( iterator,					      &length_calculated,					      &file_content );    iterator = gsb_file_save_party_part ( iterator,					  &length_calculated,					  &file_content );    iterator = gsb_file_save_category_part ( iterator,					     &length_calculated,					     &file_content );    iterator = gsb_file_save_budgetary_part ( iterator,					      &length_calculated,					      &file_content );    iterator = gsb_file_save_currency_part ( iterator,					     &length_calculated,					     &file_content );    iterator = gsb_file_save_bank_part ( iterator,					 &length_calculated,					 &file_content );    iterator = gsb_file_save_financial_year_part ( iterator,						   &length_calculated,						   &file_content );    iterator = gsb_file_save_reconcile_part ( iterator,					      &length_calculated,					      &file_content );    iterator = gsb_file_save_report_part ( iterator,					   &length_calculated,					   &file_content,					   FALSE );    /* finish the file */    iterator = gsb_file_save_append_part ( iterator,					   &length_calculated,					   &file_content,					   g_strdup ("</Grisbi>"));    /* before saving the file, we compress and crypt it if necessary */    if ( compress )	iterator = gsb_file_util_compress_file ( &file_content,						 iterator,						 TRUE );    iterator = gsb_file_util_crypt_file ( filename, &file_content, TRUE, iterator );        /* the file is in memory, we can save it */    grisbi_file = fopen ( filename,			  "w" );    if ( !grisbi_file	 ||	 !fwrite ( file_content,		   sizeof (gchar),		   iterator,		   grisbi_file ))    {	dialogue_error ( g_strdup_printf ( _("Cannot save file '%s': %s"),					   filename,					   latin2utf8(strerror(errno)) ));	free ( file_content);	return ( FALSE );    }        fclose (grisbi_file);    free ( file_content);    /* if it's a new file, we set the permission */    if ( do_chmod )	chmod ( filename,		S_IRUSR | S_IWUSR );    etat.en_train_de_sauvegarder = 0;    return ( TRUE );}