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

Unified Diff: third_party/re2/util/sparse_set.h

Issue 10873029: Migrate WebRequestRedirectByRegExAction to use RE2 and roll RE2 to revision 97:401ab4168e8e (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT 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/util/sparse_array.h ('k') | third_party/re2/util/util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/util/sparse_set.h
diff --git a/third_party/re2/util/sparse_set.h b/third_party/re2/util/sparse_set.h
index 9cb57534f9a46276626577202b9161539d510035..165dd090eb49df4fc4a96259eb707d2d8a2370c7 100644
--- a/third_party/re2/util/sparse_set.h
+++ b/third_party/re2/util/sparse_set.h
@@ -54,15 +54,16 @@ namespace re2 {
class SparseSet {
public:
SparseSet()
- : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL) {}
+ : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL), valgrind_(RunningOnValgrind()) {}
SparseSet(int max_size) {
max_size_ = max_size;
sparse_to_dense_ = new int[max_size];
dense_ = new int[max_size];
+ valgrind_ = RunningOnValgrind();
// Don't need to zero the memory, but do so anyway
// to appease Valgrind.
- if (RunningOnValgrind()) {
+ if (valgrind_) {
for (int i = 0; i < max_size; i++) {
dense_[i] = 0xababababU;
sparse_to_dense_[i] = 0xababababU;
@@ -94,7 +95,7 @@ class SparseSet {
int* a = new int[new_max_size];
if (sparse_to_dense_) {
memmove(a, sparse_to_dense_, max_size_*sizeof a[0]);
- if (RunningOnValgrind()) {
+ if (valgrind_) {
for (int i = max_size_; i < new_max_size; i++)
a[i] = 0xababababU;
}
@@ -105,7 +106,7 @@ class SparseSet {
a = new int[new_max_size];
if (dense_) {
memmove(a, dense_, size_*sizeof a[0]);
- if (RunningOnValgrind()) {
+ if (valgrind_) {
for (int i = size_; i < new_max_size; i++)
a[i] = 0xababababU;
}
@@ -168,6 +169,7 @@ class SparseSet {
int max_size_;
int* sparse_to_dense_;
int* dense_;
+ bool valgrind_;
DISALLOW_EVIL_CONSTRUCTORS(SparseSet);
};
« no previous file with comments | « third_party/re2/util/sparse_array.h ('k') | third_party/re2/util/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698