diff options
-rw-r--r-- | stream.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -3086,12 +3086,6 @@ val get_char(val stream_in) return ops->get_char(stream); } -static val us_get_char(val stream) -{ - struct strm_ops *ops = coerce(struct strm_ops *, stream->co.ops); - return ops->get_char(stream); -} - val get_byte(val stream_in) { val self = lit("get-byte"); @@ -3120,12 +3114,6 @@ val unget_char(val ch, val stream_in) return ops->unget_char(stream, ch); } -static val us_unget_char(val ch, val stream) -{ - struct strm_ops *ops = coerce(struct strm_ops *, stream->co.ops); - return ops->unget_char(stream, ch); -} - val unget_byte(val byte, val stream_in) { val self = lit("unget-byte"); @@ -5442,19 +5430,22 @@ val get_csv(val source_opt) if3(stringp(source_opt), make_string_input_stream(source_opt), (class_check(self, source_opt, stream_cls), source_opt))); + struct strm_ops *ops = coerce(struct strm_ops *, source->co.ops); + val (*get_char)(val) = ops->get_char; + val (*unget_char)(val, val) = ops->unget_char; val record = nil, field = nil; enum { init, rfield, qfield, quot } state = init; int done = 0; while (!done) { - val ch = us_get_char(source); + val ch = get_char(source); if (ch == chr('\r')) { - val ch2 = us_get_char(source); + val ch2 = get_char(source); if (ch2 == chr('\n')) ch = ch2; else if (ch2) - us_unget_char(ch2, source); + unget_char(source, ch2); } else if (ch == nil) { if (state == init) return nil; |