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

Side by Side Diff: net/base/lookup_string_in_fixed_set.cc

Issue 2653613004: Simpler repro of DCHECK badness in release builds.
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/lookup_string_in_fixed_set.h" 5 #include "net/base/lookup_string_in_fixed_set.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // returned. 89 // returned.
90 int LookupStringInFixedSet(const unsigned char* graph, 90 int LookupStringInFixedSet(const unsigned char* graph,
91 size_t length, 91 size_t length,
92 const char* key, 92 const char* key,
93 size_t key_length) { 93 size_t key_length) {
94 const unsigned char* pos = graph; 94 const unsigned char* pos = graph;
95 const unsigned char* end = graph + length; 95 const unsigned char* end = graph + length;
96 const unsigned char* offset = pos; 96 const unsigned char* offset = pos;
97 const char* key_end = key + key_length; 97 const char* key_end = key + key_length;
98 while (GetNextOffset(&pos, end, &offset)) { 98 while (GetNextOffset(&pos, end, &offset)) {
99 DCHECK((pos == nullptr) || pos < end);
99 // char <char>+ end_char offsets 100 // char <char>+ end_char offsets
100 // char <char>+ return value 101 // char <char>+ return value
101 // char end_char offsets 102 // char end_char offsets
102 // char return value 103 // char return value
103 // end_char offsets 104 // end_char offsets
104 // return_value 105 // return_value
105 bool did_consume = false; 106 bool did_consume = false;
106 if (key != key_end && !IsEOL(offset, end)) { 107 if (key != key_end && !IsEOL(offset, end)) {
107 // Leading <char> is not a match. Don't dive into this child 108 // Leading <char> is not a match. Don't dive into this child
108 if (!IsMatch(offset, end, key)) 109 if (!IsMatch(offset, end, key))
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return kDafsaNotFound; // Unexpected 144 return kDafsaNotFound; // Unexpected
144 continue; 145 continue;
145 } 146 }
146 ++key; 147 ++key;
147 pos = ++offset; // Dive into child 148 pos = ++offset; // Dive into child
148 } 149 }
149 return kDafsaNotFound; // No match 150 return kDafsaNotFound; // No match
150 } 151 }
151 152
152 } // namespace net 153 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698