1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

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.
This commit is contained in:
Andy Wingo 2016-04-19 19:50:21 +02:00
parent 10dc6d043e
commit ffb4347d53
5 changed files with 61 additions and 36 deletions

View file

@ -240,7 +240,7 @@ SCM_DEFINE (scm_write_string_partial, "write-string/partial", 1, 3, 0,
/* Filling the last character in the buffer would require a
flush. */
if (write_len < scm_port_buffer_size (write_buf) - write_buf->end)
if (write_len < scm_port_buffer_can_put (write_buf))
{
scm_c_write_unlocked (port, src, write_len);
return scm_from_long (write_len);