From 6dbf365f144df4a55294244b1a1cd6f679992456 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 19 Nov 2012 13:02:45 +0100 Subject: cleanup strings[0] before invoking done(): can only be a preliminary solution --- parser.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'parser.cpp') diff --git a/parser.cpp b/parser.cpp index 864eba0..049711f 100644 --- a/parser.cpp +++ b/parser.cpp @@ -13,7 +13,7 @@ #include "qbuffers.h" #include "parser.h" -#define DEBUG +//#define DEBUG gint macro_pc = 0; @@ -49,9 +49,9 @@ macro_execute(const gchar *macro) throw (State::Error) { while (macro[macro_pc]) { #ifdef DEBUG - g_printf("EXEC(%d): input='%c'/%x, state=%p\n", + g_printf("EXEC(%d): input='%c'/%x, state=%p, mode=%d\n", macro_pc, macro[macro_pc], macro[macro_pc], - States::current); + States::current, mode); #endif State::input(macro[macro_pc]); @@ -267,13 +267,15 @@ StateExpectString::custom(gchar chr) throw (Error) } if (g_ascii_toupper(chr) == escape_char) { - State *next = done(strings[0] ? : ""); + gchar *string = strings[0]; + undo.push_str(strings[0]); + strings[0] = NULL; + + State *next = done(string ? : ""); + g_free(string); undo.push_var(escape_char); escape_char = '\x1B'; - undo.push_str(strings[0]); - g_free(strings[0]); - strings[0] = NULL; undo.push_var(machine); machine.state = Machine::STATE_START; -- cgit v1.2.3