Remove some unnecessary pointer save/restore logic.
There is no need to save t->capture[1] and then restore it to
t->capture[0] (?!) when we do nothing else with t before freeing it.
Change-Id: I2b09b99b3e00658ba4299433f60ced67ec8df448
Reviewed-on: https://code-review.googlesource.com/4604
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/nfa.cc b/re2/nfa.cc
index dd59c67..40d1194 100644
--- a/re2/nfa.cc
+++ b/re2/nfa.cc
@@ -357,7 +357,6 @@
if (endmatch_ && p != etext_)
break;
- const char* old = t->capture[1]; // previous end pointer
t->capture[1] = p;
if (longest_) {
// Leftmost-longest mode: save this match only if
@@ -374,7 +373,6 @@
// Cut off the threads that can only find matches
// worse than the one we just found: don't run the
// rest of the current Threadq.
- t->capture[0] = old;
FreeThread(t);
for (++i; i != runq->end(); ++i)
FreeThread(i->second);
@@ -382,7 +380,6 @@
matched_ = true;
return 0;
}
- t->capture[0] = old;
matched_ = true;
break;
}