mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
misc cleanup
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@780 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
58cbff5b7c
commit
cec5cb3918
@ -797,7 +797,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
|
||||
* if we see something else, assume the worst, free the last
|
||||
* transaction, and return */
|
||||
if ('!' == qifline[0]) {
|
||||
xaccFreeTransaction (trans);
|
||||
xaccTransDestroy (trans);
|
||||
return qifline;
|
||||
}
|
||||
|
||||
|
@ -319,17 +319,6 @@ xaccFreeTransaction( Transaction *trans )
|
||||
|
||||
if (!trans) return;
|
||||
|
||||
/* free a transaction only if it is not claimed
|
||||
* by any accounts. */
|
||||
|
||||
i = 0;
|
||||
s = trans->splits[i];
|
||||
while (s) {
|
||||
if (s->acc) return;
|
||||
i++;
|
||||
s = trans->splits[i];
|
||||
}
|
||||
|
||||
/* free up the destination splits */
|
||||
i = 0;
|
||||
s = trans->splits[i];
|
||||
@ -361,6 +350,28 @@ xaccFreeTransaction( Transaction *trans )
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccTransDestroy (Transaction *trans)
|
||||
{
|
||||
int i;
|
||||
Split *split;
|
||||
|
||||
if (!trans) return;
|
||||
|
||||
i=0;
|
||||
split = trans->splits[i];
|
||||
while (split) {
|
||||
xaccAccountRemoveSplit (split->acc, split);
|
||||
i++;
|
||||
split = trans->splits[i];
|
||||
}
|
||||
|
||||
xaccFreeTransaction (trans);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccTransBeginEdit (Transaction *trans)
|
||||
{
|
||||
|
@ -64,6 +64,13 @@ typedef struct _transaction Transaction;
|
||||
Transaction * xaccMallocTransaction (void); /* mallocs and inits */
|
||||
void xaccInitTransaction (Transaction *);/* clears a trans struct */
|
||||
|
||||
/* The xaccTransactionDestroy() method will remove all
|
||||
* of the splits from each of thier accounts, free the memory
|
||||
* associated with them, and will then free the transaction
|
||||
* itself.
|
||||
*/
|
||||
void xaccTransDestroy (Transaction *);
|
||||
|
||||
void xaccTransBeginEdit (Transaction *);
|
||||
void xaccTransCommitEdit (Transaction *);
|
||||
|
||||
|
@ -105,10 +105,20 @@ struct _transaction
|
||||
};
|
||||
|
||||
|
||||
/* freeTransaction only does so if the transaction is not part of an
|
||||
* account. (i.e. if none of the member splits are in an account). */
|
||||
/* The xaccFreeTransaction() method simply frees all memory associated
|
||||
* with the transaction. It does not perform any consistency checks
|
||||
* to verify that such freeing can be safely done. (e.g. id does
|
||||
* not check to see if any of the member splits are referenced
|
||||
* by an account.
|
||||
*/
|
||||
void xaccFreeTransaction (Transaction *);
|
||||
|
||||
/* The xaccFreeSplit() method simply frees all memory associated
|
||||
* with the split. It does not verify that the split isn't
|
||||
* referenced in some account. If the split is referenced by an
|
||||
* account, then calling this method will leave the system in an
|
||||
* inconsistent state.
|
||||
*/
|
||||
void xaccFreeSplit (Split *); /* frees memory */
|
||||
|
||||
/* The xaccTransRemoveSplit() routine will remove the indicated
|
||||
|
Loading…
Reference in New Issue
Block a user