summaryrefslogtreecommitdiff
path: root/src/annotate.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-11 03:55:25 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-11 03:55:25 -0500
commit363670d35bf451ff8ce636c071da73a0d93c514a (patch)
tree153899e85596849bcbe96c820d5d55bbc61f1d8b /src/annotate.cc
parent2303aa993cf41ad5bde8f8f5722bd265c11e3aa7 (diff)
downloadfork-ledger-363670d35bf451ff8ce636c071da73a0d93c514a.tar.gz
fork-ledger-363670d35bf451ff8ce636c071da73a0d93c514a.tar.bz2
fork-ledger-363670d35bf451ff8ce636c071da73a0d93c514a.zip
Tighten up argument passing related to fn_market()
Diffstat (limited to 'src/annotate.cc')
-rw-r--r--src/annotate.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/annotate.cc b/src/annotate.cc
index d2c7f983..2b118e76 100644
--- a/src/annotate.cc
+++ b/src/annotate.cc
@@ -241,16 +241,16 @@ bool annotated_commodity_t::operator==(const commodity_t& comm) const
}
optional<price_point_t>
-annotated_commodity_t::find_price(const optional<commodity_t&>& commodity,
- const optional<datetime_t>& moment,
- const optional<datetime_t>& oldest) const
+annotated_commodity_t::find_price(const commodity_t * commodity,
+ const datetime_t& moment,
+ const datetime_t& oldest) const
{
DEBUG("commodity.price.find",
"annotated_commodity_t::find_price(" << symbol() << ")");
datetime_t when;
- if (moment)
- when = *moment;
+ if (! moment.is_not_a_date_time())
+ when = moment;
else if (epoch)
when = *epoch;
else
@@ -258,7 +258,7 @@ annotated_commodity_t::find_price(const optional<commodity_t&>& commodity,
DEBUG("commodity.price.find", "reference time: " << when);
- optional<commodity_t&> target;
+ const commodity_t * target = NULL;
if (commodity)
target = commodity;
@@ -272,7 +272,7 @@ annotated_commodity_t::find_price(const optional<commodity_t&>& commodity,
}
else if (! target) {
DEBUG("commodity.price.find", "setting target commodity from price");
- target = details.price->commodity();
+ target = details.price->commodity_ptr();
}
}
@@ -285,7 +285,7 @@ annotated_commodity_t::find_price(const optional<commodity_t&>& commodity,
return find_price_from_expr(const_cast<expr_t&>(*details.value_expr),
commodity, when);
- return commodity_t::find_price(commodity, moment, oldest);
+ return commodity_t::find_price(target, moment, oldest);
}
commodity_t&