* srfi-19.scm (priv:locale-reader): don't need open-output-string.
authorRob Browning <rlb@defaultvalue.org>
Fri, 6 Jul 2001 14:00:13 +0000 (14:00 +0000)
committerRob Browning <rlb@defaultvalue.org>
Fri, 6 Jul 2001 14:00:13 +0000 (14:00 +0000)
srfi/srfi-19.scm

index a059bc8..d95ba9a 100644 (file)
 
 ;; looking at a char, read the char string, run thru indexer, return index
 (define (priv:locale-reader port indexer)
-  (let ((string-port (open-output-string)))
-    (define (read-char-string)
-      (let ((ch (peek-char port)))
-        (if (char-alphabetic? ch)
-            (begin (write-char (read-char port) string-port) 
-                   (read-char-string))
-            (get-output-string string-port))))
-    (let* ((str (read-char-string)) 
-           (index (indexer str)))
-      (if index index (priv:time-error 'string->date
-                                       'bad-date-template-string
-                                       (list "Invalid string for " indexer))))))
+
+  (define (read-char-string result)
+    (let ((ch (peek-char port)))
+      (if (char-alphabetic? ch)
+          (read-char-string (cons (read-char port) result))
+          (list->string (reverse! result)))))
+  
+  (let* ((str (read-char-string '())) 
+         (index (indexer str)))
+    (if index index (priv:time-error 'string->date
+                                     'bad-date-template-string
+                                     (list "Invalid string for " indexer)))))
 
 (define (priv:make-locale-reader indexer)
   (lambda (port)