From 7c72d4e172d27dc3d62a3b55dda77a99bc58bf9a Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 14 May 2006 21:01:44 +0000 Subject: [PATCH] (skip_scsh_block_comment): Recognize "!#" everywhere, not just on a line of its own. (Backport 1.8 fix by Marius Vollmer .) --- libguile/read.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libguile/read.c b/libguile/read.c index 195b9566d..0bb830db0 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -255,21 +255,21 @@ static void skip_scsh_block_comment (SCM port) #define FUNC_NAME "skip_scsh_block_comment" { - /* Is this portable? Dear God, spare me from the non-eight-bit - characters. But is it tasteful? */ - long history = 0; + int bang_seen = 0; for (;;) { int c = scm_getc (port); - + if (c == EOF) SCM_MISC_ERROR ("unterminated `#! ... !#' comment", SCM_EOL); - history = ((history << 8) | (c & 0xff)) & 0xffffffff; - /* Were the last four characters read "\n!#\n"? */ - if (history == (('\n' << 24) | ('!' << 16) | ('#' << 8) | '\n')) + if (c == '!') + bang_seen = 1; + else if (c == '#' && bang_seen) return; + else + bang_seen = 0; } } #undef FUNC_NAME