Rename to Regexp::RequiredPrefixForAccel().
Change-Id: I72084774560d1989d5eac937f4a5039802713d69
Reviewed-on: https://code-review.googlesource.com/c/re2/+/56772
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/compile.cc b/re2/compile.cc
index 05890c0..30e55f5 100644
--- a/re2/compile.cc
+++ b/re2/compile.cc
@@ -1190,7 +1190,7 @@
if (!prog_->reversed()) {
std::string prefix;
bool prefix_foldcase;
- if (re->RequiredPrefixUnanchored(&prefix, &prefix_foldcase) &&
+ if (re->RequiredPrefixForAccel(&prefix, &prefix_foldcase) &&
!prefix_foldcase) {
prog_->prefix_size_ = prefix.size();
prog_->prefix_front_ = prefix.front();
diff --git a/re2/regexp.cc b/re2/regexp.cc
index b84f371..4364d0a 100644
--- a/re2/regexp.cc
+++ b/re2/regexp.cc
@@ -716,7 +716,7 @@
// Determines whether regexp matches must be unanchored
// with a fixed string prefix. If so, returns the prefix.
// The prefix might be ASCII case-insensitive.
-bool Regexp::RequiredPrefixUnanchored(std::string* prefix, bool* foldcase) {
+bool Regexp::RequiredPrefixForAccel(std::string* prefix, bool* foldcase) {
prefix->clear();
*foldcase = false;
diff --git a/re2/regexp.h b/re2/regexp.h
index b39ef69..5284ab5 100644
--- a/re2/regexp.h
+++ b/re2/regexp.h
@@ -445,7 +445,7 @@
// case-folding). If so, returns the prefix.
// Callers should expect *prefix and *foldcase to be "zeroed"
// regardless of the return value.
- bool RequiredPrefixUnanchored(std::string* prefix, bool* foldcase);
+ bool RequiredPrefixForAccel(std::string* prefix, bool* foldcase);
private:
// Constructor allocates vectors as appropriate for operator.
diff --git a/re2/testing/required_prefix_test.cc b/re2/testing/required_prefix_test.cc
index 2468ec2..c00e812 100644
--- a/re2/testing/required_prefix_test.cc
+++ b/re2/testing/required_prefix_test.cc
@@ -73,7 +73,7 @@
}
}
-static PrefixTest unanchored_tests[] = {
+static PrefixTest for_accel_tests[] = {
// Empty cases.
{ "", false },
{ "(?m)^", false },
@@ -97,9 +97,9 @@
{ "☺abc", true, "☺abc", false, },
};
-TEST(RequiredPrefixUnanchored, SimpleTests) {
- for (size_t i = 0; i < arraysize(unanchored_tests); i++) {
- const PrefixTest& t = unanchored_tests[i];
+TEST(RequiredPrefixForAccel, SimpleTests) {
+ for (size_t i = 0; i < arraysize(for_accel_tests); i++) {
+ const PrefixTest& t = for_accel_tests[i];
for (size_t j = 0; j < 2; j++) {
Regexp::ParseFlags flags = Regexp::LikePerl;
if (j == 0)
@@ -109,7 +109,7 @@
std::string p;
bool f;
- ASSERT_EQ(t.return_value, re->RequiredPrefixUnanchored(&p, &f))
+ ASSERT_EQ(t.return_value, re->RequiredPrefixForAccel(&p, &f))
<< " " << t.regexp << " " << (j == 0 ? "latin1" : "utf8")
<< " " << re->Dump();
if (t.return_value) {