diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-12-25 11:43:16 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-12-25 11:43:16 -0800 |
commit | fd4bdd5889162d26bf2f195224e6a3c675696f8e (patch) | |
tree | abf3605e7eab57f9b0c059515cf4a57622c2a33a /lib.c | |
parent | 1f9ca760323c55d500876ec765001b43bbef8a53 (diff) | |
download | txr-fd4bdd5889162d26bf2f195224e6a3c675696f8e.tar.gz txr-fd4bdd5889162d26bf2f195224e6a3c675696f8e.tar.bz2 txr-fd4bdd5889162d26bf2f195224e6a3c675696f8e.zip |
* lib.c (simple_lazy_stream_func): Bugfix: close the stream
if get_line returns nil.
* stream.c (cat_get_line, cat_get_char, cat_get_byte): The catenated
stream read operations close an exhausted stream before popping
to the next one.
* txr.1: Document closing behavior of catenated streams.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -5083,10 +5083,12 @@ toobig: static val simple_lazy_stream_func(val stream, val lcons) { - if (set(mkloc(lcons->lc.car, lcons), get_line(stream)) != nil) + if (set(mkloc(lcons->lc.car, lcons), get_line(stream)) != nil) { set(mkloc(lcons->lc.cdr, lcons), make_lazy_cons(lcons->lc.func)); - else + } else { + close_stream(stream, t); lcons->lc.cdr = nil; + } return nil; } |