summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-22 02:13:41 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-22 02:13:41 -0400
commit5619a1d5be144877df8cce01c40ff668bbb0c96a (patch)
tree387fe6c47cb0998e31e4dfdedc664077d4562407 /amount.cc
parent6d5333b89618734e59853ba7da75b920ac40dae0 (diff)
downloadfork-ledger-5619a1d5be144877df8cce01c40ff668bbb0c96a.tar.gz
fork-ledger-5619a1d5be144877df8cce01c40ff668bbb0c96a.tar.bz2
fork-ledger-5619a1d5be144877df8cce01c40ff668bbb0c96a.zip
a little more reorganizing, but only fractionally faster. diminishing returns!
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/amount.cc b/amount.cc
index ed51f356..8a827d94 100644
--- a/amount.cc
+++ b/amount.cc
@@ -50,7 +50,7 @@ static struct init_amounts {
mpz_init(true_value);
mpz_set_ui(true_value, 1);
}
-#ifndef NO_CLEANUP
+#ifdef DO_CLEANUP
~init_amounts() {
mpz_clear(true_value);
mpz_clear(divisor);
@@ -593,8 +593,9 @@ amount_t amount_t::round(unsigned int prec) const
} else {
amount_t temp = *this;
temp._dup();
- mpz_round(MPZ(temp.quantity), MPZ(temp.quantity), quantity->prec, prec);
- quantity->prec = prec;
+ mpz_round(MPZ(temp.quantity), MPZ(temp.quantity),
+ temp.quantity->prec, prec);
+ temp.quantity->prec = prec;
return temp;
}
}
@@ -929,7 +930,8 @@ commodities_map commodity_t::commodities;
commodity_t * commodity_t::null_commodity =
commodity_t::find_commodity("", true);
-#ifndef NO_CLEANUP
+#ifdef DO_CLEANUP
+
static struct cleanup_commodities
{
~cleanup_commodities() {
@@ -943,7 +945,8 @@ static struct cleanup_commodities
delete (*i).second;
}
} _cleanup;
-#endif
+
+#endif // DO_CLEANUP
commodity_t * commodity_t::find_commodity(const std::string& symbol,
bool auto_create)