summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--stream.c13
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 99910e74..45f388d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/stream.c b/stream.c
index a0bcf33e..95b84bc5 100644
--- a/stream.c
+++ b/stream.c
@@ -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;
+ }
}
}