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

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

Issue 12033058: Updated to most recent version RE2 and remove upstreamed patches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/re2/parse.cc ('k') | third_party/re2/testinstall.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/re2.cc
diff --git a/third_party/re2/re2/re2.cc b/third_party/re2/re2/re2.cc
index 61b88e7389cb9a9fc0c04fa91c0695e48b9ef6a7..fb43abf5a426533db943f402f060687021f93dbd 100644
--- a/third_party/re2/re2/re2.cc
+++ b/third_party/re2/re2/re2.cc
@@ -9,8 +9,6 @@
#include "re2/re2.h"
-#include <ctype.h>
-
#include <stdio.h>
#include <string>
#ifdef WIN32
@@ -152,7 +150,8 @@ int RE2::Options::ParseFlags() const {
int flags = Regexp::ClassNL;
switch (encoding()) {
default:
- LOG(ERROR) << "Unknown encoding " << encoding();
+ if (log_errors())
+ LOG(ERROR) << "Unknown encoding " << encoding();
break;
case RE2::Options::EncodingUTF8:
break;
@@ -554,10 +553,11 @@ bool RE2::Match(const StringPiece& text,
}
if (startpos < 0 || startpos > endpos || endpos > text.size()) {
- LOG(ERROR) << "RE2: invalid startpos, endpos pair.";
+ if (options_.log_errors())
+ LOG(ERROR) << "RE2: invalid startpos, endpos pair.";
return false;
}
-
+
StringPiece subtext = text;
subtext.remove_prefix(startpos);
subtext.remove_suffix(text.size() - endpos);
@@ -673,7 +673,8 @@ bool RE2::Match(const StringPiece& text,
LOG(INFO) << "Match " << trunc(pattern_)
<< " [" << CEscape(subtext) << "]"
<< " DFA inconsistency.";
- LOG(ERROR) << "DFA inconsistency";
+ if (options_.log_errors())
+ LOG(ERROR) << "DFA inconsistency";
return false;
}
if (FLAGS_trace_re2)
@@ -757,7 +758,7 @@ bool RE2::Match(const StringPiece& text,
<< " [" << CEscape(subtext) << "]"
<< " using OnePass.";
if (!prog_->SearchOnePass(subtext1, text, anchor, kind, submatch, ncap)) {
- if (!skipped_test)
+ if (!skipped_test && options_.log_errors())
LOG(ERROR) << "SearchOnePass inconsistency";
return false;
}
@@ -768,7 +769,7 @@ bool RE2::Match(const StringPiece& text,
<< " using BitState.";
if (!prog_->SearchBitState(subtext1, text, anchor,
kind, submatch, ncap)) {
- if (!skipped_test)
+ if (!skipped_test && options_.log_errors())
LOG(ERROR) << "SearchBitState inconsistency";
return false;
}
@@ -778,7 +779,7 @@ bool RE2::Match(const StringPiece& text,
<< " [" << CEscape(subtext) << "]"
<< " using NFA.";
if (!prog_->SearchNFA(subtext1, text, anchor, kind, submatch, ncap)) {
- if (!skipped_test)
+ if (!skipped_test && options_.log_errors())
LOG(ERROR) << "SearchNFA inconsistency";
return false;
}
@@ -877,8 +878,10 @@ bool RE2::Rewrite(string *out, const StringPiece &rewrite,
if (isdigit(c)) {
int n = (c - '0');
if (n >= veclen) {
- LOG(ERROR) << "requested group " << n
- << " in regexp " << rewrite.data();
+ if (options_.log_errors()) {
+ LOG(ERROR) << "requested group " << n
+ << " in regexp " << rewrite.data();
+ }
return false;
}
StringPiece snip = vec[n];
@@ -887,7 +890,8 @@ bool RE2::Rewrite(string *out, const StringPiece &rewrite,
} else if (c == '\\') {
out->push_back('\\');
} else {
- LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
+ if (options_.log_errors())
+ LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
return false;
}
} else {
« no previous file with comments | « third_party/re2/re2/parse.cc ('k') | third_party/re2/testinstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698