summaryrefslogtreecommitdiff
path: root/libguile/read.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-04-19 19:50:21 +0200
committerAndy Wingo <wingo@pobox.com>2016-04-19 20:02:05 +0200
commitffb4347d5330fbd2b3e78d761613955f83aeef3d (patch)
treee4e0d3fa781937bf3ecb93a29e93c67ad98c64b9 /libguile/read.c
parent10dc6d043e0b76f36461f0a04160a4d2f411413e (diff)
Port buffer cur/next pointers are Scheme values
* libguile/ports.h (scm_t_port_buffer): Change "cur" and "end" members to be SCM values, in preparation for changing port buffers to be Scheme vectors. (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt. * libguile/ports.c (scm_c_make_port_buffer): Initialize cur and end members. (looking_at_bytes): Use helper instead of incrementing cur. (scm_i_read_unlocked): Adapt to end type change. (CONSUME_PEEKED_BYTE): Use helper instead of incrementing cur. (scm_i_unget_bytes_unlocked): Use helper instead of comparing cur. (scm_i_write_unlocked): Fix for changing end/cur types. * libguile/read.c (scm_i_scan_for_encoding): Use helpers instead of addressing cursors directly. * libguile/rw.c (scm_write_string_partial): Likewise. * libguile/ports-internal.h (scm_port_buffer_reset): (scm_port_buffer_reset_end, scm_port_buffer_can_take): (scm_port_buffer_can_put, scm_port_buffer_can_putback): (scm_port_buffer_did_take, scm_port_buffer_did_put): (scm_port_buffer_take_pointer, scm_port_buffer_put_pointer): (scm_port_buffer_putback): Adapt to data types.
Diffstat (limited to 'libguile/read.c')
-rw-r--r--libguile/read.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libguile/read.c b/libguile/read.c
index a4357d179..bc5c3c179 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -2074,11 +2074,11 @@ scm_i_scan_for_encoding (SCM port)
pt->rw_active = SCM_PORT_READ;
}
- if (buf->cur == buf->end)
+ if (scm_port_buffer_can_take (buf) == 0)
{
/* We can use the read buffer, and thus avoid a seek. */
buf = scm_fill_input_unlocked (port);
- bytes_read = buf->end - buf->cur;
+ bytes_read = scm_port_buffer_can_take (buf);
if (bytes_read > SCM_ENCODING_SEARCH_SIZE)
bytes_read = SCM_ENCODING_SEARCH_SIZE;