diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-09-23 19:01:01 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-09-23 19:01:01 +0200 |
commit | b66a552487b875b2897177eafcb7e4b68b140b0a (patch) | |
tree | d0adbea53575b0d4888a206473dd4db70aeb4768 /libguile/srfi-4.c | |
parent | 21c097e0ed0fb2e934c3a1b112c018e6cbe51e43 (diff) | |
parent | fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4 (diff) | |
download | guile-b66a552487b875b2897177eafcb7e4b68b140b0a.tar.gz |
Merge branch 'master' into boehm-demers-weiser-gc
Diffstat (limited to 'libguile/srfi-4.c')
-rw-r--r-- | libguile/srfi-4.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c index b00fdaf28..3e43a4985 100644 --- a/libguile/srfi-4.c +++ b/libguile/srfi-4.c @@ -858,38 +858,11 @@ SCM_DEFINE (scm_uniform_vector_read_x, "uniform-vector-read!", 1, 3, 0, if (SCM_NIMP (port_or_fd)) { - scm_t_port *pt = SCM_PTAB_ENTRY (port_or_fd); - - if (pt->rw_active == SCM_PORT_WRITE) - scm_flush (port_or_fd); - ans = cend - cstart; - while (remaining > 0) - { - if (pt->read_pos < pt->read_end) - { - size_t to_copy = min (pt->read_end - pt->read_pos, - remaining); - - memcpy (base + off, pt->read_pos, to_copy); - pt->read_pos += to_copy; - remaining -= to_copy; - off += to_copy; - } - else - { - if (scm_fill_input (port_or_fd) == EOF) - { - if (remaining % sz != 0) - SCM_MISC_ERROR ("unexpected EOF", SCM_EOL); - ans -= remaining / sz; - break; - } - } - } - - if (pt->rw_random) - pt->rw_active = SCM_PORT_READ; + remaining -= scm_c_read (port_or_fd, base + off, remaining); + if (remaining % sz != 0) + SCM_MISC_ERROR ("unexpected EOF", SCM_EOL); + ans -= remaining / sz; } else /* file descriptor. */ { |