From 1a973c42e20a721c28adab1c41861b9bfa96c128 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Mon, 9 Jun 2003 20:02:20 +0000 Subject: [PATCH] (scm_peek_char): Safe the column of the port around the getc/ungetc calls. Thanks to Dr. Peter Ivanyi! --- libguile/ports.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libguile/ports.c b/libguile/ports.c index 96dcd2fe6..a77a91dbd 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -1198,15 +1198,17 @@ SCM_DEFINE (scm_peek_char, "peek-char", 0, 1, 0, "to @code{read-char} would have hung.}") #define FUNC_NAME s_scm_peek_char { - int c; + int c, column; if (SCM_UNBNDP (port)) port = scm_cur_inp; else SCM_VALIDATE_OPINPORT (1, port); + column = SCM_COL(port); c = scm_getc (port); if (EOF == c) return SCM_EOF_VAL; scm_ungetc (c, port); + SCM_COL(port) = column; return SCM_MAKE_CHAR (c); } #undef FUNC_NAME