summaryrefslogtreecommitdiff
path: root/libguile/ioext.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-04-04 11:03:52 +0200
committerAndy Wingo <wingo@pobox.com>2016-04-04 16:30:57 +0200
commit2caae477c55ed945555715150606a097d8b50f9b (patch)
tree457f4251155af83b9a2908248f52dfd2c2e7092b /libguile/ioext.c
parentb538a96f927d5a0079655bd6df8f019c008930ee (diff)
downloadguile-2caae477c55ed945555715150606a097d8b50f9b.tar.gz
Refactor to rw_random / rw_active port flags
* libguile/fports.c (fport_flush, fport_end_input): Move rw_active handling to ports.c. * libguile/ioext.c (scm_redirect_port): Use scm_flush_unlocked instead of calling the flush function directly. * libguile/ports.c (scm_c_make_port_with_encoding): Ports default to "rw_random" mode when they have a seek function. (scm_c_read_unlocked, scm_i_unget_bytes_unlocked) (scm_slow_get_byte_or_eof_unlocked) (scm_slow_peek_byte_or_eof_unlocked): Flush write buffer and set rw_active always in the same way, and only if rw_random is true. (scm_end_input_unlocked, scm_flush_unlocked): Clear rw_active here unconditionally. (scm_c_write_unlocked): Flush read buffer and set rw_active always in the same way, but only if rw_random is true. (scm_c_write, scm_lfwrite): Whitespace fixes. (scm_lfwrite_substr): Don't flush read buffer; lower-level code will do this. (scm_truncate_file): Use scm_flush_unlocked instead of calling the flush function directly. * libguile/r6rs-ports.c (transcoded_port_flush): Don't muck with rw_active. * libguile/read.c (scm_i_scan_for_encoding): Flush write buffer if needed in same way as ports.c. * libguile/strports.c (st_end_input): Don't muck with rw_active. (scm_mkstrport): rw_random defaults to 1 now.
Diffstat (limited to 'libguile/ioext.c')
-rw-r--r--libguile/ioext.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libguile/ioext.c b/libguile/ioext.c
index 659eabcf5..25ce01471 100644
--- a/libguile/ioext.c
+++ b/libguile/ioext.c
@@ -88,11 +88,10 @@ SCM_DEFINE (scm_redirect_port, "redirect-port", 2, 0, 0,
{
scm_t_port *pt = SCM_PTAB_ENTRY (new);
scm_t_port *old_pt = SCM_PTAB_ENTRY (old);
- scm_t_ptob_descriptor *ptob = SCM_PORT_DESCRIPTOR (new);
/* must flush to old fdes. */
if (pt->rw_active == SCM_PORT_WRITE)
- ptob->flush (new);
+ scm_flush_unlocked (new);
else if (pt->rw_active == SCM_PORT_READ)
scm_end_input_unlocked (new);
ans = dup2 (oldfd, newfd);