summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-05-01 22:00:37 +0200
committerAndy Wingo <wingo@pobox.com>2016-05-01 22:00:37 +0200
commit422f65fe09e93bff383cc3e818204902ed0d32d2 (patch)
treefcad303d2d28b76c743ff0a3cca6daf194823d03
parent4ba59e94f988602cc07ab79b1e617194dd4d03b0 (diff)
downloadguile-422f65fe09e93bff383cc3e818204902ed0d32d2.tar.gz
Minor tweak to Scheme peek-byte.
* module/ice-9/ports.scm (peek-byte): Use second return from fill-input.
-rw-r--r--module/ice-9/ports.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index 2bc12c5c3..db1c6f7fe 100644
--- a/module/ice-9/ports.scm
+++ b/module/ice-9/ports.scm
@@ -241,11 +241,12 @@
(cur (port-buffer-cur buf)))
(if (< cur (port-buffer-end buf))
(bytevector-u8-ref (port-buffer-bytevector buf) cur)
- (let* ((buf (fill-input port))
- (cur (port-buffer-cur buf)))
- (if (< cur (port-buffer-end buf))
- (bytevector-u8-ref (port-buffer-bytevector buf) cur)
- the-eof-object)))))
+ (call-with-values (lambda () (fill-input port))
+ (lambda (buf buffered)
+ (if (zero? buffered)
+ the-eof-object
+ (bytevector-u8-ref (port-buffer-bytevector buf)
+ (port-buffer-cur buf))))))))