summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--parser.h1
-rw-r--r--parser.l5
-rw-r--r--txr.c2
4 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bdb76184..2b76dd01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2011-10-26 Kaz Kylheku <kaz@kylheku.com>
+ Bugfix: prepared_error_message variable needs to be gc-protected.
+
+ * parser.h (parse_init): Declared.
+
+ * parser.l (parse_init): New function.
+
+ * txr.c (main): Call parse_init.
+ (txr_main): No need to gc-protect yyin_stream since parse_init does it.
+
+2011-10-26 Kaz Kylheku <kaz@kylheku.com>
+
Parse error handling improvements.
* parser.l (prepared_error_message): New static variable.
diff --git a/parser.h b/parser.h
index 5429ee59..7d7e1fb8 100644
--- a/parser.h
+++ b/parser.h
@@ -37,3 +37,4 @@ void yyerrorf(val s, ...);
void yybadtoken(int tok, val context);
void end_of_regex(void);
int yylex(void);
+void parse_init(void);
diff --git a/parser.l b/parser.l
index 08bdfbb3..af6da051 100644
--- a/parser.l
+++ b/parser.l
@@ -589,3 +589,8 @@ void end_of_regex(void)
|| yy_top_state() == QSILIT)
yy_pop_state();
}
+
+void parse_init(void)
+{
+ protect(&yyin_stream, &prepared_error_message, (val *) 0);
+}
diff --git a/txr.c b/txr.c
index 706e9ee1..410339c5 100644
--- a/txr.c
+++ b/txr.c
@@ -146,6 +146,7 @@ int main(int argc, char **argv)
progname = argv[0] ? utf8_dup_from(argv[0]) : progname;
init(progname, oom_realloc_handler, &stack_bottom);
match_init();
+ parse_init();
return txr_main(argc, argv);
}
@@ -159,7 +160,6 @@ int txr_main(int argc, char **argv)
prot1(&spec_file_str);
yyin_stream = std_input;
- prot1(&yyin_stream);
if (argc <= 1) {
hint();