[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-104-gdfb57

From: Andreas Rottmann
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-104-gdfb572a
Date: Fri, 27 May 2011 14:10:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  dfb572a7bf37d70e46d91d62955fe3e404fdcc58 (commit)
      from  0687e826a12e45cec9fcf14ed642f176d230afb9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dfb572a7bf37d70e46d91d62955fe3e404fdcc58
Author: Andreas Rottmann <address@hidden>
Date:   Fri May 27 16:09:04 2011 +0200

    Tweak R6RS transcoded ports flushing
    * libguile/r6rs-ports.c (tp_flush): Only operate on the underlying port
      when it is open.


Summary of changes:
 libguile/r6rs-ports.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c
index f12af16..6eff97d 100644
--- a/libguile/r6rs-ports.c
+++ b/libguile/r6rs-ports.c
@@ -1177,12 +1177,21 @@ tp_flush (SCM port)
   scm_t_port *c_port = SCM_PTAB_ENTRY (port);
   size_t count = c_port->write_pos - c_port->write_buf;
-  scm_c_write (binary_port, c_port->write_buf, count);
+  /* As the runtime will try to flush all ports upon exit, we test for
+     the underlying port still being open here. Otherwise, when you
+     would explicitly close the underlying port and the transcoded port
+     still had data outstanding, you'd get an exception on Guile exit.
+     We just throw away the data when the underlying port is closed.  */
+  if (SCM_OPOUTPORTP (binary_port))
+      scm_c_write (binary_port, c_port->write_buf, count);
   c_port->write_pos = c_port->write_buf;
   c_port->rw_active = SCM_PORT_NEITHER;
-  scm_force_output (binary_port);
+  if (SCM_OPOUTPORTP (binary_port))
+    scm_force_output (binary_port);
 static int

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]