summaryrefslogtreecommitdiff
path: root/balance.h
diff options
context:
space:
mode:
Diffstat (limited to 'balance.h')
-rw-r--r--balance.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/balance.h b/balance.h
index 8f953fd5..2327d761 100644
--- a/balance.h
+++ b/balance.h
@@ -97,14 +97,10 @@ class balance_t
}
balance_t& operator-=(const amount_t& amt) {
amounts_map::iterator i = amounts.find(&amt.commodity());
- if (i != amounts.end()) {
+ if (i != amounts.end())
(*i).second -= amt;
- if (! (*i).second)
- amounts.erase(&amt.commodity());
- }
- else if (amt) {
+ else
amounts.insert(amounts_pair(&amt.commodity(), - amt));
- }
return *this;
}
template <typename T>
@@ -151,10 +147,7 @@ class balance_t
balance_t& operator*=(const amount_t& amt) {
// Multiplying by the null commodity causes all amounts to be
// increased by the same factor.
- if (! amt) {
- amounts.clear();
- }
- else if (! amt.commodity()) {
+ if (! amt.commodity()) {
for (amounts_map::iterator i = amounts.begin();
i != amounts.end();
i++)