From e684c60f44de155f5949d947c57baca870f827af Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sat, 18 Sep 1999 08:36:35 +0000 Subject: [PATCH] 1999-09-18 Gary Houston * strports.c (scm_strport_to_string): create the string from pt->read_buf instead of an expression that evaluates to the same thing. * gdbint.c (gdb_print): don't just use SCM_CHARS to get a C string from the port: the port's buffer may not be NUL terminated. --- libguile/ChangeLog | 9 +++++++++ libguile/gdbint.c | 8 +++++++- libguile/strports.c | 3 +-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index cdee3a6ac..7cd349f22 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,12 @@ +1999-09-18 Gary Houston + + * strports.c (scm_strport_to_string): create the string from + pt->read_buf instead of an expression that evaluates to the + same thing. + + * gdbint.c (gdb_print): don't just use SCM_CHARS to get a C string + from the port: the port's buffer may not be NUL terminated. + 1999-09-16 Mikael Djurfeldt * Makefile.am (.c.x): Added missing semicolon after `false'. diff --git a/libguile/gdbint.c b/libguile/gdbint.c index e2f429c8d..c3c6cdd38 100644 --- a/libguile/gdbint.c +++ b/libguile/gdbint.c @@ -275,7 +275,13 @@ gdb_print (obj) scm_seek (gdb_output_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET)); scm_write (obj, gdb_output_port); scm_truncate_file (gdb_output_port, SCM_UNDEFINED); - SEND_STRING (SCM_CHARS (SCM_STREAM (gdb_output_port))); + { + scm_port *pt = SCM_PTAB_ENTRY (gdb_output_port); + + scm_flush (gdb_output_port); + *(pt->write_buf + pt->read_buf_size) = 0; + SEND_STRING (pt->read_buf); + } SCM_END_FOREIGN_BLOCK; return 0; } diff --git a/libguile/strports.c b/libguile/strports.c index 4ea718f23..3989fb111 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -266,8 +266,7 @@ SCM scm_strport_to_string (SCM port) if (pt->rw_active == SCM_PORT_WRITE) st_flush (port); - return scm_makfromstr (SCM_CHARS (SCM_STREAM (port)), - pt->read_buf_size, 0); + return scm_makfromstr (pt->read_buf, pt->read_buf_size, 0); } SCM_PROC(s_call_with_output_string, "call-with-output-string", 1, 0, 0, scm_call_with_output_string);