summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-05 07:17:25 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-05 07:17:25 -0700
commitd8508c2754622b7c3d7196aa9261f82ed29982b5 (patch)
tree7792cbe8f4444b4fdefa7945ea232c7e4642f214 /stream.c
parent0fe8e3d8a566dbd82dede5c392224d23245fb0f8 (diff)
downloadtxr-d8508c2754622b7c3d7196aa9261f82ed29982b5.tar.gz
txr-d8508c2754622b7c3d7196aa9261f82ed29982b5.tar.bz2
txr-d8508c2754622b7c3d7196aa9261f82ed29982b5.zip
* stream.c (width_check): Just use the public
put_char function; no need to manipulate column or call put_indent.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/stream.c b/stream.c
index 6f8db48f..514b7140 100644
--- a/stream.c
+++ b/stream.c
@@ -2747,24 +2747,17 @@ val inc_indent(val stream, val delta)
val width_check(val stream, val alt)
{
- struct strm_ops *ops = coerce(struct strm_ops *, cobj_ops(stream, stream_s));
- struct strm_base *s = coerce(struct strm_base *, stream->co.handle);
+ struct strm_base *s = coerce(struct strm_base *,
+ cobj_handle(stream, stream_s));
if ((s->indent_mode == indent_code &&
s->column >= s->indent_chars + s->code_width) ||
(s->indent_mode == indent_data &&
s->column >= s->indent_chars + s->data_width))
{
- if (ops->put_char(stream, chr('\n')) &&
- put_indent(stream, ops, s->indent_chars)) {
- s->column = s->indent_chars;
- return t;
- }
- return nil;
+ put_char(chr('\n'), stream);
} else if (alt) {
- ops->put_char(stream, alt);
- s->column++;
- return t;
+ put_char(alt, stream);
}
return t;