aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-08 22:17:43 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-08 22:25:51 +0100
commit809e7ff25062023dfda16a9dd6a84d2a427dda24 (patch)
treefccb07bf1287039086bc2d9ccfab0410bded051f /src
parentee35a5d130c17a957384f05b0d034fd3747b1f7c (diff)
downloadsciteco-809e7ff25062023dfda16a9dd6a84d2a427dda24.tar.gz
reverse Execute::step() change: no need to pass parameters by reference
cmdline and cmdline_pos is no longer modified by code executed by step() instead it is modified at the outermost macro level (commandline macro level)
Diffstat (limited to 'src')
-rw-r--r--src/cmdline.cpp2
-rw-r--r--src/parser.cpp6
-rw-r--r--src/parser.h2
3 files changed, 4 insertions, 6 deletions
diff --git a/src/cmdline.cpp b/src/cmdline.cpp
index 4796560..e710e14 100644
--- a/src/cmdline.cpp
+++ b/src/cmdline.cpp
@@ -87,7 +87,7 @@ cmdline_keypress(gchar key)
while (cmdline_pos <= (gint)strlen(cmdline)) {
try {
- Execute::step((const gchar *&)cmdline, cmdline_pos);
+ Execute::step(cmdline, cmdline_pos);
} catch (ReplaceCmdline &r) {
undo.pop(r.pos);
diff --git a/src/parser.cpp b/src/parser.cpp
index 314c156..15fcbdf 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -71,7 +71,7 @@ gchar *strings[2] = {NULL, NULL};
gchar escape_char = '\x1B';
void
-Execute::step(const gchar *&macro, gint &stop_pos)
+Execute::step(const gchar *macro, gint stop_pos)
throw (State::Error, ReplaceCmdline)
{
while (macro_pc < stop_pos) {
@@ -93,8 +93,6 @@ void
Execute::macro(const gchar *macro, bool locals)
throw (State::Error, ReplaceCmdline)
{
- gint macro_len = strlen(macro);
-
GotoTable *parent_goto_table = Goto::table;
GotoTable macro_goto_table(false);
@@ -118,7 +116,7 @@ Execute::macro(const gchar *macro, bool locals)
}
try {
- step(macro, macro_len);
+ step(macro, strlen(macro));
if (Goto::skip_label)
throw State::Error("Label \"%s\" not found",
Goto::skip_label);
diff --git a/src/parser.h b/src/parser.h
index d2e570b..e810fa4 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -262,7 +262,7 @@ extern gchar *strings[2];
extern gchar escape_char;
namespace Execute {
- void step(const gchar *&macro, gint &stop_pos)
+ void step(const gchar *macro, gint stop_pos)
throw (State::Error, ReplaceCmdline);
void macro(const gchar *macro, bool locals = true)
throw (State::Error, ReplaceCmdline);