summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/stream.c b/stream.c
index 05c6ee77..d112c71e 100644
--- a/stream.c
+++ b/stream.c
@@ -690,9 +690,6 @@ static val stdio_unget_char(val stream, val ch)
{
struct stdio_handle *h = coerce(struct stdio_handle *, stream->co.handle);
- if (!is_chr(ch))
- type_mismatch(lit("unget-char: ~s is not a character"), ch, nao);
-
if (h->unget_c)
uw_throwf(file_error_s, lit("unget-char overflow on ~a: "), stream, nao);
@@ -2314,6 +2311,8 @@ val unget_char(val ch, val stream_in)
{
val stream = default_arg(stream_in, std_input);
struct strm_ops *ops = coerce(struct strm_ops *, cobj_ops(stream, stream_s));
+ if (!is_chr(ch))
+ type_mismatch(lit("unget-char: ~s is not a character"), ch, nao);
return ops->unget_char(stream, ch);
}