mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
CsvTransExp - limit scope of variable to actual use
This commit is contained in:
parent
aa0a68fd1c
commit
545f27c550
@ -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);
|
||||
|
@ -72,7 +72,6 @@ typedef struct
|
||||
CsvExportType export_type;
|
||||
CsvExportDate csvd;
|
||||
CsvExportAcc csva;
|
||||
GList *trans_list;
|
||||
|
||||
Query *query;
|
||||
Account *account;
|
||||
|
@ -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("");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user