minor updates

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1231 57a11ea4-9604-0410-9ed3-97b8803252fd
zzzoldfeatures/xacc-12-patch
Linas Vepstas 28 years ago
parent 8f1c031850
commit a374b9938a

@ -124,26 +124,21 @@ xaccFreeAccount( Account *acc )
if (acc->security) free (acc->security);
/* any split pointing at this account needs to be unmarked */
i=0;
s = acc->splits[0];
while (s) {
s->acc = NULL;
i++;
for (i=0; i<acc->numSplits; i++) {
s = acc->splits[i];
s->acc = NULL;
}
/* search for orphaned transactions, and delete them */
i=0;
s = acc->splits[0];
while (s) {
xaccSplitDestroy (s);
i++;
for (i=0; i<acc->numSplits; i++) {
s = acc->splits[i];
xaccSplitDestroy (s);
}
/* free up array of split pointers */
_free (acc->splits);
acc->splits = NULL;
acc->numSplits = 0;
/* zero out values, just in case stray
* pointers are pointing here. */

@ -749,13 +749,12 @@ xaccSplitDestroy (Split *split)
trans = split->parent;
assert (trans);
assert (trans->splits);
CHECK_OPEN (trans);
// temp hack alert -- get rid of annoying error messages
// CHECK_OPEN (trans);
numsplits = 0;
s = trans->splits[0];
while (s) {
/* xxxxxxx */
printf ("SplitDestroy(): trans=%p, %d'th split=%p\n", trans, numsplits, s);
MARK_SPLIT(s);
if (s == split) ismember = 1;
numsplits ++;
@ -763,10 +762,17 @@ printf ("SplitDestroy(): trans=%p, %d'th split=%p\n", trans, numsplits, s);
}
assert (ismember);
/* if the account has three or more splits,
/* If the account has three or more splits,
* merely unlink & free the split.
*
* Or if the account has only two splits, and the
* split to be destroyed is a price split (i.e.
* has a damount value of zero), then
* merely unlink & free the split.
*/
if (2 < numsplits) {
if ((2 < numsplits) ||
((2 == numsplits) && (DEQ(0.0, split->damount))))
{
MARK_SPLIT (split);
xaccTransRemoveSplit (trans, split);
acc = split->acc;

Loading…
Cancel
Save