From dd10aab53a3fde04f05fe6399496b36e625b4c37 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 31 Jul 2014 12:00:06 -0700 Subject: [PATCH] Balance ENTER with a LEAVE for all exit points. For xaccLotFill and xaccLotScrubDoubleBalance, anyway. --- src/engine/Scrub2.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/engine/Scrub2.c b/src/engine/Scrub2.c index d938cae518..4522183405 100644 --- a/src/engine/Scrub2.c +++ b/src/engine/Scrub2.c @@ -106,14 +106,28 @@ xaccLotFill (GNCLot *lot) ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName(acc)); /* If balance already zero, we have nothing to do. */ - if (gnc_lot_is_closed (lot)) return; - + if (gnc_lot_is_closed (lot)) + { + LEAVE ("Lot Closed (lot=%s, acc=%s)", gnc_lot_get_title(lot), + xaccAccountGetName(acc)); + return; + } split = pcy->PolicyGetSplit (pcy, lot); - if (!split) return; /* Handle the common case */ + if (!split) + { + LEAVE ("No Split (lot=%s, acc=%s)", gnc_lot_get_title(lot), + xaccAccountGetName(acc)); + return; /* Handle the common case */ + } /* Reject voided transactions */ if (gnc_numeric_zero_p(split->amount) && - xaccTransGetVoidStatus(split->parent)) return; + xaccTransGetVoidStatus(split->parent)) + { + LEAVE ("Voided transaction (lot=%s, acc=%s)", + gnc_lot_get_title(lot), xaccAccountGetName(acc)); + return; + } xaccAccountBeginEdit (acc); @@ -166,7 +180,11 @@ xaccLotScrubDoubleBalance (GNCLot *lot) } /* We double-check only closed lots */ - if (FALSE == gnc_lot_is_closed (lot)) return; + if (FALSE == gnc_lot_is_closed (lot)) + { + LEAVE ("lot=%s is closed", gnc_lot_get_title(lot)); + return; + } for (snode = gnc_lot_get_split_list(lot); snode; snode = snode->next) {