diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-24 02:40:28 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-24 02:40:28 -0400 |
commit | 267b2ba5d80f2d4f9897fb5ad633716d5a8a6752 (patch) | |
tree | 6a97c299754b2d73372c97baaf89660083f56da0 /src/commodity.cc | |
parent | 2422838005a93999d18d98d4d57dc3ada1d4781b (diff) | |
download | fork-ledger-267b2ba5d80f2d4f9897fb5ad633716d5a8a6752.tar.gz fork-ledger-267b2ba5d80f2d4f9897fb5ad633716d5a8a6752.tar.bz2 fork-ledger-267b2ba5d80f2d4f9897fb5ad633716d5a8a6752.zip |
Made commodity reduction during parsing consistent
Diffstat (limited to 'src/commodity.cc')
-rw-r--r-- | src/commodity.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/commodity.cc b/src/commodity.cc index 5832e2b8..c65ad0a4 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -638,7 +638,8 @@ void annotation_t::parse(std::istream& in) amount_t temp; temp.parse(buf, amount_t::PARSE_NO_MIGRATE); - temp.in_place_reduce(); + + DEBUG("commodity.annotations", "Parsed annotation price: " << temp); // Since this price will maintain its own precision, make sure // it is at least as large as the base commodity, since the user @@ -683,8 +684,12 @@ void annotation_t::parse(std::istream& in) } } while (true); - DEBUG("amounts.commodities", - "Parsed commodity annotations: " << std::endl << *this); +#if defined(DEBUG_ON) + if (SHOW_DEBUG("amounts.commodities") && *this) { + DEBUG("amounts.commodities", + "Parsed commodity annotations: " << std::endl << *this); + } +#endif } bool annotated_commodity_t::operator==(const commodity_t& comm) const @@ -775,9 +780,7 @@ bool compare_amount_commodities::operator()(const amount_t * left, if (aleftcomm.details.price && arightcomm.details.price) { amount_t leftprice(*aleftcomm.details.price); - leftprice.in_place_reduce(); amount_t rightprice(*arightcomm.details.price); - rightprice.in_place_reduce(); if (leftprice.commodity() == rightprice.commodity()) { return (leftprice - rightprice).sign() < 0; |