From 5619a1d5be144877df8cce01c40ff668bbb0c96a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 22 Aug 2004 02:13:41 -0400 Subject: a little more reorganizing, but only fractionally faster. diminishing returns! --- amount.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'amount.cc') 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) -- cgit v1.2.3