Make scm_c_read use caller buffer only for unbuffered ports.
authorNeil Jerram <neil@ossau.uklinux.net>
Sun, 23 Nov 2008 22:37:23 +0000 (22:37 +0000)
committerNeil Jerram <neil@ossau.uklinux.net>
Sun, 23 Nov 2008 22:48:26 +0000 (22:48 +0000)
commit6d2275560d32a157e1d26b15cdd73fb80daef526
tree0f4951d1477bbe4e786aa0ac24217fa2f501974c
parentc9e44fd755ae3bba217f3ae053d4ffc1c26ddc57
Make scm_c_read use caller buffer only for unbuffered ports.

We recently modified scm_c_read so that it temporarily swaps the
caller's buffer with the port's normal read buffer, in order to
improve performance in the case where the port is unbuffered (which
actually means having a single-byte buffer) - but we implemented the
swap in the buffered case too.  The latter turns out to be a bad idea
- because it means that the C code of a custom port implementation
cannot rely on a port's buffer always being the same as when it was
first set up - and so this commit reverts that.  The buffer swapping
trick now applies to unbuffered ports only.

* libguile/ports.c (scm_c_read): Only do swapping of port and caller
  buffer for unbuffered ports.
libguile/ports.c