summaryrefslogtreecommitdiff
path: root/libguile/r6rs-ports.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-04-17 19:38:44 +0200
committerAndy Wingo <wingo@pobox.com>2016-04-17 19:38:44 +0200
commitb869344a4f238ad66ab33e08de5c7b66ed823fc3 (patch)
treefdf0c47f6413a63034aad0050a1720c6aafdcb4a /libguile/r6rs-ports.c
parentf62974000f74c2e6e160b02137ab037466812014 (diff)
Remove size field from port buffers
* libguile/ports.h (scm_t_port_buffer): Remove size field. Instead use bytevector size. * libguile/ports-internal.h (scm_port_buffer_size) (scm_port_buffer_reset) (scm_port_buffer_can_take, scm_port_buffer_can_put) (scm_port_buffer_did_take, scm_port_buffer_did_put) (scm_port_buffer_take_pointer, scm_port_buffer_put_pointer) (scm_port_buffer_take, scm_port_buffer_put): New helpers. * libguile/filesys.c (set_element): Use new helpers. * libguile/poll.c (scm_primitive_poll): Use new helpers. * libguile/ports.c (scm_c_make_port_buffer): No more "size" field. (scm_i_read_unlocked, scm_c_read_bytes_unlocked) (scm_c_read_unlocked, scm_i_unget_bytes_unlocked) (scm_unget_bytes, scm_setvbuf, scm_take_from_input_buffers) (scm_drain_input, scm_end_input_unlocked, scm_flush_unlocked) (scm_fill_input_unlocked, scm_i_write_unlocked) (scm_c_write_bytes_unlocked, scm_c_write_unlocked) (scm_char_ready_p): Use new helpers. * libguile/r6rs-ports.c (scm_get_bytevector_some): Use new helpers. * libguile/rw.c (scm_write_string_partial): Use new helpers.
Diffstat (limited to 'libguile/r6rs-ports.c')
-rw-r--r--libguile/r6rs-ports.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c
index c1cf95af3..4c5c87ca5 100644
--- a/libguile/r6rs-ports.c
+++ b/libguile/r6rs-ports.c
@@ -475,13 +475,13 @@ SCM_DEFINE (scm_get_bytevector_some, "get-bytevector-some", 1, 0, 0,
SCM_VALIDATE_BINARY_INPUT_PORT (1, port);
buf = scm_fill_input_unlocked (port);
- if (buf->cur == buf->end)
+ size = scm_port_buffer_can_take (buf);
+ if (size == 0)
{
buf->has_eof_p = SCM_BOOL_F;
return SCM_EOF_VAL;
}
- size = buf->end - buf->cur;
bv = scm_c_make_bytevector (size);
scm_take_from_input_buffers
(port, (char *) SCM_BYTEVECTOR_CONTENTS (bv), size);