Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: third_party/re2/re2/filtered_re2.cc

Issue 1516543002: Update re2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated update instructions Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/re2/re2/filtered_re2.h ('k') | third_party/re2/re2/make_perl_groups.pl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/filtered_re2.cc
diff --git a/third_party/re2/re2/filtered_re2.cc b/third_party/re2/re2/filtered_re2.cc
index f57625895e471978d2b61e28f4f1be133ea2dd07..5dd65d5b71c1e21a4c5e39b03231fc84ea2d8944 100644
--- a/third_party/re2/re2/filtered_re2.cc
+++ b/third_party/re2/re2/filtered_re2.cc
@@ -16,7 +16,7 @@ FilteredRE2::FilteredRE2()
}
FilteredRE2::~FilteredRE2() {
- for (int i = 0; i < re2_vec_.size(); i++)
+ for (size_t i = 0; i < re2_vec_.size(); i++)
delete re2_vec_[i];
delete prefilter_tree_;
}
@@ -33,7 +33,7 @@ RE2::ErrorCode FilteredRE2::Add(const StringPiece& pattern,
}
delete re;
} else {
- *id = re2_vec_.size();
+ *id = static_cast<int>(re2_vec_.size());
re2_vec_.push_back(re);
}
@@ -46,7 +46,7 @@ void FilteredRE2::Compile(vector<string>* atoms) {
return;
}
- for (int i = 0; i < re2_vec_.size(); i++) {
+ for (size_t i = 0; i < re2_vec_.size(); i++) {
Prefilter* prefilter = Prefilter::FromRE2(re2_vec_[i]);
prefilter_tree_->Add(prefilter);
}
@@ -56,9 +56,9 @@ void FilteredRE2::Compile(vector<string>* atoms) {
}
int FilteredRE2::SlowFirstMatch(const StringPiece& text) const {
- for (int i = 0; i < re2_vec_.size(); i++)
+ for (size_t i = 0; i < re2_vec_.size(); i++)
if (RE2::PartialMatch(text, *re2_vec_[i]))
- return i;
+ return static_cast<int>(i);
return -1;
}
@@ -70,7 +70,7 @@ int FilteredRE2::FirstMatch(const StringPiece& text,
}
vector<int> regexps;
prefilter_tree_->RegexpsGivenStrings(atoms, &regexps);
- for (int i = 0; i < regexps.size(); i++)
+ for (size_t i = 0; i < regexps.size(); i++)
if (RE2::PartialMatch(text, *re2_vec_[regexps[i]]))
return regexps[i];
return -1;
@@ -83,18 +83,23 @@ bool FilteredRE2::AllMatches(
matching_regexps->clear();
vector<int> regexps;
prefilter_tree_->RegexpsGivenStrings(atoms, &regexps);
- for (int i = 0; i < regexps.size(); i++)
+ for (size_t i = 0; i < regexps.size(); i++)
if (RE2::PartialMatch(text, *re2_vec_[regexps[i]]))
matching_regexps->push_back(regexps[i]);
return !matching_regexps->empty();
}
+void FilteredRE2::AllPotentials(
+ const vector<int>& atoms,
+ vector<int>* potential_regexps) const {
+ prefilter_tree_->RegexpsGivenStrings(atoms, potential_regexps);
+}
+
void FilteredRE2::RegexpsGivenStrings(const vector<int>& matched_atoms,
vector<int>* passed_regexps) {
prefilter_tree_->RegexpsGivenStrings(matched_atoms, passed_regexps);
}
-
void FilteredRE2::PrintPrefilter(int regexpid) {
prefilter_tree_->PrintPrefilter(regexpid);
}
« no previous file with comments | « third_party/re2/re2/filtered_re2.h ('k') | third_party/re2/re2/make_perl_groups.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698