From dfab2fe21f82bc40cfdf9a3a3eeb6936d5935c8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 21 Nov 2008 18:00:33 +0100 Subject: [PATCH] ports: Properly initialize the `read_buf_size' field. * src/ports.c (make_bip): Initialize `c_port->read_buf_size'. (make_cbip): Likewise. This allows CBIPs to work with the so-called `swap_buffer' trick discussed as proposed at http://lists.gnu.org/archive/html/guile-devel/2008-11/msg00071.html . --- src/ports.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ports.c b/src/ports.c index 4dc3a99..bb8eed2 100644 --- a/src/ports.c +++ b/src/ports.c @@ -84,6 +84,7 @@ make_bip (SCM bv) c_port = SCM_PTAB_ENTRY (port); c_port->read_pos = c_port->read_buf = (unsigned char *) c_bv; c_port->read_end = (unsigned char *) c_bv + c_len; + c_port->read_buf_size = c_len; /* Mark PORT as open, readable and unbuffered (hmm, how elegant...). */ SCM_SET_CELL_TYPE (port, bytevector_input_port_type | mode_bits); @@ -262,6 +263,7 @@ make_cbip (SCM read_proc, SCM get_position_proc, c_port = SCM_PTAB_ENTRY (port); c_port->read_pos = c_port->read_buf = (unsigned char *) c_bv; c_port->read_end = (unsigned char *) c_bv; + c_port->read_buf_size = c_len; /* Mark PORT as open, readable and unbuffered (hmm, how elegant...). */ SCM_SET_CELL_TYPE (port, custom_binary_input_port_type | mode_bits); -- 2.11.4.GIT