mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
throw an error on get-output-string on non-string-ports (issue #621)
This commit is contained in:
parent
d19ee75800
commit
1795014dae
1 changed files with 2 additions and 0 deletions
2
sexp.c
2
sexp.c
|
@ -1708,6 +1708,8 @@ sexp sexp_get_output_string_op (sexp ctx, sexp self, sexp_sint_t n, sexp out) {
|
|||
sexp_assert_type(ctx, sexp_oportp, SEXP_OPORT, out);
|
||||
if (!sexp_port_openp(out))
|
||||
return sexp_xtype_exception(ctx, self, "output port is closed", out);
|
||||
if (!sexp_pairp(sexp_port_cookie(out)))
|
||||
return sexp_xtype_exception(ctx, self, "not a string output port", out);
|
||||
sexp_gc_preserve3(ctx, ls, rev, tmp);
|
||||
if (sexp_port_offset(out) > 0) {
|
||||
tmp = sexp_c_string(ctx, sexp_port_buf(out), sexp_port_offset(out));
|
||||
|
|
Loading…
Add table
Reference in a new issue