[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/08: Minor tweak to Scheme peek-byte.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/08: Minor tweak to Scheme peek-byte. |
Date: |
Wed, 04 May 2016 10:43:53 +0000 |
wingo pushed a commit to branch wip-port-refactor
in repository guile.
commit 422f65fe09e93bff383cc3e818204902ed0d32d2
Author: Andy Wingo <address@hidden>
Date: Sun May 1 22:00:37 2016 +0200
Minor tweak to Scheme peek-byte.
* module/ice-9/ports.scm (peek-byte): Use second return from
fill-input.
---
module/ice-9/ports.scm | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index 2bc12c5..db1c6f7 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))))))))
- [Guile-commits] branch wip-port-refactor updated (1309ab8 -> d7a111b), Andy Wingo, 2016/05/04
- [Guile-commits] 06/08: Initial peek-char implementation in Scheme, Andy Wingo, 2016/05/04
- [Guile-commits] 01/08: Changes to Scheme fill-input corresponding to C, Andy Wingo, 2016/05/04
- [Guile-commits] 02/08: Minor tweak to Scheme peek-byte.,
Andy Wingo <=
- [Guile-commits] 07/08: Add integer->char and char->integer opcodes, Andy Wingo, 2016/05/04
- [Guile-commits] 03/08: Port encoding internally represented as symbol, Andy Wingo, 2016/05/04
- [Guile-commits] 05/08: Port refactors to help Scheme peek-char, Andy Wingo, 2016/05/04
- [Guile-commits] 08/08: Spead tweaks to Scheme peek-char, Andy Wingo, 2016/05/04
- [Guile-commits] 04/08: Port conversion strategies internally are symbols, Andy Wingo, 2016/05/04