diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | stream.c | 13 |
2 files changed, 13 insertions, 5 deletions
@@ -1,5 +1,10 @@ 2014-02-23 Kaz Kylheku <kaz@kylheku.com> + * stream.c (get_string_from_stream): Bugfix: do not abort if + stream is not a string stream, but throw a proper error exception. + +2014-02-23 Kaz Kylheku <kaz@kylheku.com> + Get special variable overriding working in function and macro parameter lists. @@ -1228,7 +1228,8 @@ val get_string_from_stream(val stream) { type_check (stream, COBJ); type_assert (stream->co.cls == stream_s, - (lit("~a is not a stream"), stream, nao)); + (lit("~a is not a stream"), + stream, nao)); if (stream->co.ops == &string_out_ops.cobj_ops) { struct string_output *so = (struct string_output *) stream->co.handle; @@ -1247,11 +1248,13 @@ val get_string_from_stream(val stream) out = string_own(so->buf); free(so); return out; - } else if (stream->co.ops == &string_in_ops.cobj_ops) { - val pair = (val) stream->co.handle; - return pair ? car(pair) : nil; } else { - abort(); /* not a string input or output stream */ + type_assert (stream->co.ops == &string_in_ops.cobj_ops, + (lit("~a is not a string stream"), stream, nao)); + { + val pair = (val) stream->co.handle; + return pair ? car(pair) : nil; + } } } |