summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-09 03:19:38 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-09 03:25:53 -0600
commitca8f702a1b18f2f114cd580abe59f03fb85e4803 (patch)
tree2f4e820ca842dbc9c39461acd767c2baad4f3236 /src/amount.cc
parent628875b33c4f1cd202091c9347ef0176f8b688fa (diff)
downloadfork-ledger-ca8f702a1b18f2f114cd580abe59f03fb85e4803.tar.gz
fork-ledger-ca8f702a1b18f2f114cd580abe59f03fb85e4803.tar.bz2
fork-ledger-ca8f702a1b18f2f114cd580abe59f03fb85e4803.zip
Added amount_t::commodity_ptr()
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/amount.cc b/src/amount.cc
index c80ca14e..d1aa1655 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -867,10 +867,15 @@ bool amount_t::fits_in_long() const
return mpfr_fits_slong_p(tempf, GMP_RNDN);
}
-commodity_t& amount_t::commodity() const
+commodity_t * amount_t::commodity_ptr() const
{
return (has_commodity() ?
- *commodity_ : *commodity_pool_t::current_pool->null_commodity);
+ commodity_ : commodity_pool_t::current_pool->null_commodity);
+}
+
+commodity_t& amount_t::commodity() const
+{
+ return *commodity_ptr();
}
bool amount_t::has_commodity() const