summaryrefslogtreecommitdiffstats
path: root/strudel.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-29 06:37:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-29 06:37:10 -0700
commitb01dcd8533183810adec7bd52edab4868a521436 (patch)
tree4714cece7e69bb09f3fa94279f460f190ed46a7e /strudel.c
parent0ee7c2b049f3e2764f9c27dcb4f849617ae52d73 (diff)
downloadtxr-b01dcd8533183810adec7bd52edab4868a521436.tar.gz
txr-b01dcd8533183810adec7bd52edab4868a521436.tar.bz2
txr-b01dcd8533183810adec7bd52edab4868a521436.zip
buf: stream: switch approach for unget_char.
We switch to the method used in string streams for ungetting characters, whereby we UTF-8 encode the pushed back character and push back the subsequent bytes, thereby unifying character and byte pushback. * buf.c (struct buf_strm): Remove member unget_c. (buf_strm_mark): Remove reference to unget_c. (strm_get_char): Remove code for obtaining previously pushed back character from s->unget_c stack. (buf_strm_unget_char): Rewrite using the approach of using utf8_encode to write the multi-byte representation of the character into utf8_tiny_buf, and then pushing back the bytes. (make_buf_stream): Don't initialize removed unget_c. * tests/018/streams.tl: New tests.
Diffstat (limited to 'strudel.c')
0 files changed, 0 insertions, 0 deletions