summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--regex.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/regex.c b/regex.c
index a5c187ff..ebd7b2f4 100644
--- a/regex.c
+++ b/regex.c
@@ -3197,6 +3197,10 @@ static val scan_until_common(val self, val regex, val stream_in,
val match = nil;
val stream = default_arg(stream_in, std_input);
val include_match = default_null_arg(include_match_in);
+ struct strm_ops *ops = coerce(struct strm_ops *,
+ cobj_ops(self, stream, stream_cls));
+ val (*get_char)(val) = ops->get_char;
+ val (*unget_char)(val, val) = ops->unget_char;
regex_machine_init(self, &regm, regex);
@@ -3219,13 +3223,13 @@ static val scan_until_common(val self, val regex, val stream_in,
switch (regex_machine_feed(&regm, c_chr(ch))) {
case REGM_FAIL:
- unget_char(ch, stream);
+ unget_char(stream, ch);
if (match)
goto out_match;
while (stack)
- unget_char(rcyc_pop(&stack), stream);
+ unget_char(stream, rcyc_pop(&stack));
ch = get_char(stream);
@@ -3259,7 +3263,7 @@ static val scan_until_common(val self, val regex, val stream_in,
if (nil) {
out_match:
while (stack && stack != match)
- unget_char(rcyc_pop(&stack), stream);
+ unget_char(stream, rcyc_pop(&stack));
if (accum && !out)
out = null_string;
if (include_match)