From 274897fb8c59ec202c02e4dcc6d25a1c10c3d3c2 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Thu, 14 Mar 2019 09:06:22 +0800 Subject: [PATCH] [commodity-utilities] inline gnc:pricealist-lookup-nearest-in-time this is an unexported single-use function. we can safely inline. --- .../report-system/commodity-utilities.scm | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/gnucash/report/report-system/commodity-utilities.scm b/gnucash/report/report-system/commodity-utilities.scm index b8990abb05..e5fe468d2e 100644 --- a/gnucash/report/report-system/commodity-utilities.scm +++ b/gnucash/report/report-system/commodity-utilities.scm @@ -372,15 +372,6 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.") (and later (cadr later)))))) -;; Find the price of the 'commodity' in the 'pricealist' that is -;; nearest to the 'date'. -(define (gnc:pricealist-lookup-nearest-in-time pricealist commodity date) - (let ((plist (assoc-ref pricealist commodity))) - (or (and plist - (not (null? plist)) - (gnc:pricelist-price-find-nearest plist date)) - 0))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Functions to get one price at a given time (i.e. not time-variant). @@ -880,8 +871,12 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.") (gnc:make-gnc-monetary domestic (* (gnc:gnc-monetary-amount foreign) - (gnc:pricealist-lookup-nearest-in-time - pricealist (gnc:gnc-monetary-commodity foreign) date))))))) + (let ((plist (assoc-ref pricealist (gnc:gnc-monetary-commodity foreign)))) + (or (and plist + (not (null? plist)) + (gnc:pricelist-price-find-nearest plist date)) + 0)))))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Choosing exchange functions made easy -- get the right function by