CsvTransExp - limit scope of variable to actual use

This commit is contained in:
Geert Janssens 2023-02-14 16:52:13 +01:00
parent aa0a68fd1c
commit 545f27c550
3 changed files with 4 additions and 6 deletions

View File

@ -303,7 +303,6 @@ load_settings (CsvExportInfo *info)
info->separator_str = ",";
info->file_name = NULL;
info->starting_dir = NULL;
info->trans_list = NULL;
/* The default directory for the user to select files. */
info->starting_dir = gnc_get_default_directory (GNC_PREFS_GROUP);

View File

@ -72,7 +72,6 @@ typedef struct
CsvExportType export_type;
CsvExportDate csvd;
CsvExportAcc csva;
GList *trans_list;
Query *query;
Account *account;

View File

@ -438,13 +438,14 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
}
/* Run the query */
GList *trans_list = NULL;
for (GList *splits = qof_query_run (info->query); splits; splits = splits->next)
{
Split *split = splits->data;
// Look for trans already exported in trans_list
Transaction *trans = xaccSplitGetParent (split);
if (g_list_find (info->trans_list, trans))
if (g_list_find (trans_list, trans))
continue;
// Look for blank split
@ -498,11 +499,12 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
if (info->failed)
break;
}
info->trans_list = g_list_prepend (info->trans_list, trans); // add trans to trans_list
trans_list = g_list_prepend (trans_list, trans);
}
if (info->export_type == XML_EXPORT_TRANS)
qof_query_destroy (info->query);
g_list_free (trans_list);
}
@ -590,8 +592,6 @@ void csv_transactions_export (CsvExportInfo *info)
else
account_splits (info, info->account, fh);
g_list_free (info->trans_list); // free trans_list
fclose (fh);
LEAVE("");
}