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

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

Issue 10875047: Migrate WebRequestRedirectByRegExAction to use RE2 and roll RE2 to revision 97:401ab4168e8e (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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/patches/rename-posix-option.patch ('k') | third_party/re2/re2/dfa.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/compile.cc
diff --git a/third_party/re2/re2/compile.cc b/third_party/re2/re2/compile.cc
index 0c96d3395522afc9ec98c7882f428280e0fa6cf2..14e401afc55a547acf9d799702c33bde8fc25630 100644
--- a/third_party/re2/re2/compile.cc
+++ b/third_party/re2/re2/compile.cc
@@ -110,7 +110,9 @@ struct Frag {
Frag(uint32 begin, PatchList end) : begin(begin), end(end) {}
};
-static Frag kNullFrag;
+static Frag NullFrag() {
+ return Frag();
+}
// Input encodings.
enum Encoding {
@@ -588,7 +590,7 @@ static struct ByteRangeProg {
};
void Compiler::Add_80_10ffff() {
- int inst[arraysize(prog_80_10ffff)];
+ int inst[arraysize(prog_80_10ffff)] = { 0 }; // does not need to be initialized; silences gcc warning
for (int i = 0; i < arraysize(prog_80_10ffff); i++) {
const ByteRangeProg& p = prog_80_10ffff[i];
int next = 0;
@@ -683,13 +685,13 @@ Frag Compiler::PreVisit(Regexp* re, Frag, bool* stop) {
if (failed_)
*stop = true;
- return kNullFrag; // not used by caller
+ return NullFrag(); // not used by caller
}
Frag Compiler::Literal(Rune r, bool foldcase) {
switch (encoding_) {
default:
- return kNullFrag;
+ return NullFrag();
case kEncodingLatin1:
return ByteRange(r, r, foldcase);
@@ -732,7 +734,7 @@ Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
Frag f = Match(re->match_id());
// Remember unanchored match to end of string.
if (anchor_ != RE2::ANCHOR_BOTH)
- f = Cat(DotStar(), f);
+ f = Cat(DotStar(), Cat(EmptyWidth(kEmptyEndText), f));
return f;
}
@@ -1005,7 +1007,7 @@ Prog* Compiler::Compile(Regexp* re, bool reversed, int64 max_mem) {
bool is_anchor_end = IsAnchorEnd(&sre, 0);
// Generate fragment for entire regexp.
- Frag f = c.WalkExponential(sre, kNullFrag, 2*c.max_inst_);
+ Frag f = c.WalkExponential(sre, NullFrag(), 2*c.max_inst_);
sre->Decref();
if (c.failed_)
return NULL;
@@ -1096,7 +1098,7 @@ Prog* Compiler::CompileSet(const RE2::Options& options, RE2::Anchor anchor,
c.Setup(pf, options.max_mem(), anchor);
// Compile alternation of fragments.
- Frag all = c.WalkExponential(re, kNullFrag, 2*c.max_inst_);
+ Frag all = c.WalkExponential(re, NullFrag(), 2*c.max_inst_);
re->Decref();
if (c.failed_)
return NULL;
« no previous file with comments | « third_party/re2/patches/rename-posix-option.patch ('k') | third_party/re2/re2/dfa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698