From deec31a7e14232a0fc9d30d9e9846c0d9ca5e6b0 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 10 Feb 2019 14:04:07 -0800 Subject: [PATCH] Eliminate potentially-problematic use of delay for char-set-predicate. --- src/runtime/char-set.scm | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/runtime/char-set.scm b/src/runtime/char-set.scm index bed378e3a..6ddc12f84 100644 --- a/src/runtime/char-set.scm +++ b/src/runtime/char-set.scm @@ -43,21 +43,18 @@ USA. char-set? (low %char-set-low) (high %char-set-high) - (predicate %char-set-predicate) + (predicate char-set-predicate) ;; backwards compatibility for Edwin: (table %char-set-table)) (define (make-char-set low high) - (letrec - ((char-set - (%make-char-set low high - (delay - (let ((predicate - (lambda (char) - (and (char? char) - (char-in-set? char char-set))))) - (register-predicate! predicate 'char-set-predicate '<= char?) - predicate)) + (letrec* + ((predicate + (lambda (char) + (and (char? char) + (char-in-set? char char-set)))) + (char-set + (%make-char-set low high predicate (delay (let ((table (make-bytevector #x100))) (do ((cp 0 (fix:+ cp 1))) @@ -67,6 +64,7 @@ USA. 1 0))) table))))) + (register-predicate! predicate 'char-set-predicate '<= char?) char-set)) (define-integrable %low-cps-per-byte 8) @@ -446,9 +444,6 @@ USA. (else #t))) #f))))) -(define (char-set-predicate char-set) - (force (%char-set-predicate char-set))) - (define (char-set-table char-set) (force (%char-set-table char-set))) -- 2.25.1