summaryrefslogtreecommitdiff
path: root/src/journal.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-16 05:37:26 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:52 -0400
commit52822604713b73160ac497bc170eb45d9a594306 (patch)
tree867027ab9186c04e7ecb2f101247f16307116e86 /src/journal.cc
parentd89f6e1c447fc5e7fcd0d6e5a236298323f9596e (diff)
downloadfork-ledger-52822604713b73160ac497bc170eb45d9a594306.tar.gz
fork-ledger-52822604713b73160ac497bc170eb45d9a594306.tar.bz2
fork-ledger-52822604713b73160ac497bc170eb45d9a594306.zip
Modified value_t to use copy-on-write semantics.
Diffstat (limited to 'src/journal.cc')
-rw-r--r--src/journal.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/journal.cc b/src/journal.cc
index 9ff42832..2f501aff 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -153,7 +153,7 @@ bool entry_base_t::finalize()
// account if one has been set.
if (journal && journal->basket && transactions.size() == 1) {
- assert(balance.type < value_t::BALANCE);
+ assert(balance.is_type(value_t::AMOUNT));
transaction_t * nxact = new transaction_t(journal->basket);
// The amount doesn't need to be set because the code below will
// balance this transaction against the other.
@@ -166,7 +166,7 @@ bool entry_base_t::finalize()
// determine its price by dividing the unit count into the value of
// the balance. This is done for the last eligible commodity.
- if (! saw_null && balance && balance.type == value_t::BALANCE &&
+ if (! saw_null && balance && balance.is_type(value_t::BALANCE) &&
balance.as_balance().amounts.size() == 2) {
transactions_list::const_iterator x = transactions.begin();
assert((*x)->amount);
@@ -227,8 +227,8 @@ bool entry_base_t::finalize()
// commodities are involved, multiple transactions will be
// generated to balance them all.
- balance_t * bal = NULL;
- switch (balance.type) {
+ const balance_t * bal = NULL;
+ switch (balance.type()) {
case value_t::BALANCE_PAIR:
bal = &balance.as_balance_pair().quantity;
// fall through...