From ca8f702a1b18f2f114cd580abe59f03fb85e4803 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 9 Mar 2012 03:19:38 -0600 Subject: Added amount_t::commodity_ptr() --- src/amount.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/amount.cc') 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 -- cgit v1.2.3