AboutSummaryRefsLogTreeCommitDiffStats
path: root/src
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-17 19:18:29 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-12-01 00:15:56 +0100
commitae6deb8ea23570c02a7b575a53bba37048aab59f (patch)
tree1b10e1bafaded8aa74a93ed9e4dfcf98344fb66d /src
parent245413041c1ddee4bb7d752f6f1044750b887df8 (diff)
downloadmcron-ae6deb8ea23570c02a7b575a53bba37048aab59f.tar.gz
mcron-ae6deb8ea23570c02a7b575a53bba37048aab59f.tar.bz2
mcron-ae6deb8ea23570c02a7b575a53bba37048aab59f.zip
job-specifier: Use 'inf' thunk.
* src/mcron/job-specifier.scm (%find-best-next): Call 'inf' thunk instead of defining an arbitrary high integer. (bump-time): Adapt to it.
Diffstat (limited to 'src')
-rw-r--r--src/mcron/job-specifier.scm12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm
index 6dacece..5b17984 100644
--- a/src/mcron/job-specifier.scm
+++ b/src/mcron/job-specifier.scm
@@ -50,11 +50,11 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)."
(unfold (cut >= <> end) identity (cute + <> (max step 1)) start))
(define (%find-best-next current next-list)
- ;; Takes a value and a list of possible next values (all assumed less than
- ;; 9999). It returns a pair consisting of the smallest element of the
- ;; NEXT-LIST, and the smallest element larger than the CURRENT value. If an
- ;; example of the latter cannot be found, 9999 will be returned.
- (let loop ((smallest 9999) (closest+ 9999) (lst next-list))
+ ;; Takes a value and a list of possible next values. It returns a pair
+ ;; consisting of the smallest element of the NEXT-LIST, and the smallest
+ ;; element larger than the CURRENT value. If an example of the latter
+ ;; cannot be found, +INF.0 will be returned.
+ (let loop ((smallest (inf)) (closest+ (inf)) (lst next-list))
(match lst
(() (cons smallest closest+))
((time . rest)
@@ -83,7 +83,7 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)."
(if (null? value-list)
(set-component! time (+ (component time) 1))
(let ((best-next (%find-best-next (component time) (car value-list))))
- (if (eqv? 9999 (cdr best-next))
+ (if (inf? (cdr best-next))
(begin
(set-higher-component! time (+ (higher-component time) 1))
(set-component! time (car best-next)))