aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2017-07-21 14:13:58 +0200
committerLudovic Courtès <ludo@gnu.org>2017-07-21 17:03:24 +0200
commit75a4d86f50e1682b96c51eb46a6aba24afc25d03 (patch)
treeda076e62568f9647695d05266e9cfac18decece4
parent3d3e93b3f9cdf05f3dde07db45147f5919242fa2 (diff)
downloadguix-75a4d86f50e1682b96c51eb46a6aba24afc25d03.tar
guix-75a4d86f50e1682b96c51eb46a6aba24afc25d03.tar.gz
substitute: Avoid repeated calls to 'length'.
* guix/scripts/substitute.scm (fetch-narinfos)[update-progress!]: Move 'length' call outside of lambda.
-rwxr-xr-xguix/scripts/substitute.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index c066016aa4..35282f9027 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -601,13 +601,14 @@ if file doesn't exist, and the narinfo otherwise."
(define (fetch-narinfos url paths)
"Retrieve all the narinfos for PATHS from the cache at URL and return them."
(define update-progress!
- (let ((done 0))
+ (let ((done 0)
+ (total (length paths)))
(lambda ()
(display #\cr (current-error-port))
(force-output (current-error-port))
(format (current-error-port)
(G_ "updating list of substitutes from '~a'... ~5,1f%")
- url (* 100. (/ done (length paths))))
+ url (* 100. (/ done total)))
(set! done (+ 1 done)))))
(define hash-part->path