chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Remove useless peek-char when read-string is called without read


From: Evan Hanson
Subject: [PATCH] Remove useless peek-char when read-string is called without read length
Date: Mon, 28 Dec 2020 15:38:02 +1300

This call to `peek-char' was introduced by c78cdcd9, but it's useless
and was probably only included in that commit by accident. The
`read-string!/port` helper that's used just below to handle input
already takes care of everything for us, no need to peek as well.
---
 extras.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/extras.scm b/extras.scm
index cc679697..8a9f6fed 100644
--- a/extras.scm
+++ b/extras.scm
@@ -165,8 +165,7 @@
           (let ([out (open-output-string)]
                 (buf (make-string read-string-buffer-size)))
             (let loop ()
-              (let ((c (peek-char p))
-                    (n (read-string!/port read-string-buffer-size buf p 0)))
+              (let ((n (read-string!/port read-string-buffer-size buf p 0)))
                 (cond ((eq? n 0)
                        (get-output-string out))
                       (else
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]