| Index: third_party/re2/util/sparse_array.h
|
| diff --git a/third_party/re2/util/sparse_array.h b/third_party/re2/util/sparse_array.h
|
| index c024bedf224e4382fc23f24db06e592453429e0a..3e33f8999315d0c0e0fd3138ee70bafea2eed227 100644
|
| --- a/third_party/re2/util/sparse_array.h
|
| +++ b/third_party/re2/util/sparse_array.h
|
| @@ -224,13 +224,14 @@ class SparseArray {
|
| int max_size_;
|
| int* sparse_to_dense_;
|
| vector<IndexValue> dense_;
|
| + bool valgrind_;
|
|
|
| DISALLOW_EVIL_CONSTRUCTORS(SparseArray);
|
| };
|
|
|
| template<typename Value>
|
| SparseArray<Value>::SparseArray()
|
| - : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_() {}
|
| + : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(), valgrind_(RunningOnValgrind()) {}
|
|
|
| // IndexValue pairs: exposed in SparseArray::iterator.
|
| template<typename Value>
|
| @@ -272,7 +273,7 @@ void SparseArray<Value>::resize(int new_max_size) {
|
| if (sparse_to_dense_) {
|
| memmove(a, sparse_to_dense_, max_size_*sizeof a[0]);
|
| // Don't need to zero the memory but appease Valgrind.
|
| - if (RunningOnValgrind()) {
|
| + if (valgrind_) {
|
| for (int i = max_size_; i < new_max_size; i++)
|
| a[i] = 0xababababU;
|
| }
|
| @@ -417,9 +418,10 @@ void SparseArray<Value>::create_index(int i) {
|
| template<typename Value> SparseArray<Value>::SparseArray(int max_size) {
|
| max_size_ = max_size;
|
| sparse_to_dense_ = new int[max_size];
|
| + valgrind_ = RunningOnValgrind();
|
| dense_.resize(max_size);
|
| // Don't need to zero the new memory, but appease Valgrind.
|
| - if (RunningOnValgrind()) {
|
| + if (valgrind_) {
|
| for (int i = 0; i < max_size; i++) {
|
| sparse_to_dense_[i] = 0xababababU;
|
| dense_[i].index_ = 0xababababU;
|
|
|