summaryrefslogtreecommitdiff
path: root/libguile/ports.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2012-05-08 22:43:04 +0200
committerAndy Wingo <wingo@pobox.com>2012-05-08 22:43:04 +0200
commita3ded46520b35a8dbda22097b74792b8282d12ce (patch)
tree9af4c888be060263851d602031dc162023e1d55e /libguile/ports.c
parent4d497b629b73afda35ba409c3dcbfb665fe41dde (diff)
parent33672b071118f54ee637afa00349f2a4404a84da (diff)
downloadguile-a3ded46520b35a8dbda22097b74792b8282d12ce.tar.gz
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts: libguile/ports.c libguile/ports.h libguile/read.c libguile/vm-i-system.c
Diffstat (limited to 'libguile/ports.c')
-rw-r--r--libguile/ports.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libguile/ports.c b/libguile/ports.c
index f5ab24ed2..b45378592 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -2101,20 +2101,21 @@ scm_fill_input (SCM port)
return ret;
}
-/* move up to read_len chars from port's putback and/or read buffers
- into memory starting at dest. returns the number of chars moved. */
+/* Move up to READ_LEN bytes from PORT's putback and/or read buffers
+ into memory starting at DEST. Return the number of bytes moved.
+ PORT's line/column numbers are left unchanged. */
size_t
scm_take_from_input_buffers (SCM port, char *dest, size_t read_len)
{
scm_t_port *pt = SCM_PTAB_ENTRY (port);
- size_t chars_read = 0;
+ size_t bytes_read = 0;
size_t from_buf = min (pt->read_end - pt->read_pos, read_len);
if (from_buf > 0)
{
memcpy (dest, pt->read_pos, from_buf);
pt->read_pos += from_buf;
- chars_read += from_buf;
+ bytes_read += from_buf;
read_len -= from_buf;
dest += from_buf;
}
@@ -2127,10 +2128,11 @@ scm_take_from_input_buffers (SCM port, char *dest, size_t read_len)
{
memcpy (dest, pt->saved_read_pos, from_buf);
pt->saved_read_pos += from_buf;
- chars_read += from_buf;
+ bytes_read += from_buf;
}
}
- return chars_read;
+
+ return bytes_read;
}
/* Clear a port's read buffers, returning the contents. */