Skip to content

Commit 2fb9949

Browse files
committed
be less eager recompiling regexes
1 parent 63a1abe commit 2fb9949

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

checktestdata.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class Reader : public Command {
159159

160160
private:
161161
Expression string_;
162-
const void* last_string_value_ = nullptr;
162+
Value::string last_string_value_;
163163
std::optional<RE2> regex_;
164164

165165
void readString(std::string_view& in) {
@@ -174,8 +174,8 @@ class Reader : public Command {
174174

175175
void readRegex(std::string_view& in) {
176176
const auto& s = std::get<Value::string>(string_.eval().value_);
177-
if (&s != last_string_value_) {
178-
last_string_value_ = &s;
177+
if (!regex_ || s != last_string_value_) {
178+
last_string_value_ = s;
179179
regex_.emplace(s);
180180
}
181181
const char* before = in.data();

0 commit comments

Comments
 (0)