1 diff --git a/AUTHORS b/AUTHORS
2 index 3c0f928..e17d9bf 100644
7 # Please keep the list sorted.
9 +Brian Gunlogson <unixman83@gmail.com>
11 Stefano Rivera <stefano.rivera@gmail.com>
12 diff --git a/CONTRIBUTORS b/CONTRIBUTORS
13 index 7b44e04..7f6a93d 100644
18 # Please keep the list sorted.
20 +Brian Gunlogson <unixman83@gmail.com>
21 Dominic Battré <battre@chromium.org>
22 John Millikin <jmillikin@gmail.com>
23 Rob Pike <r@google.com>
24 diff --git a/re2/compile.cc b/re2/compile.cc
25 index 9cddb71..adb45fd 100644
28 @@ -502,7 +502,7 @@ int Compiler::RuneByteSuffix(uint8 lo, uint8 hi, bool foldcase, int next) {
29 return UncachedRuneByteSuffix(lo, hi, foldcase, next);
32 - uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | foldcase;
33 + uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | (foldcase ? 1ULL : 0ULL);
34 map<uint64, int>::iterator it = rune_cache_.find(key);
35 if (it != rune_cache_.end())
37 diff --git a/re2/prefilter_tree.cc b/re2/prefilter_tree.cc
38 index d8bc37a..cdcf77e 100644
39 --- a/re2/prefilter_tree.cc
40 +++ b/re2/prefilter_tree.cc
42 #include "re2/prefilter_tree.h"
47 +#define snprintf _snprintf
50 DEFINE_int32(filtered_re2_min_atom_len,
52 "Strings less than this length are not stored as atoms");
53 diff --git a/re2/re2.cc b/re2/re2.cc
54 index 8d1d468..0da886d 100644
62 +#define strtoll _strtoi64
63 +#define strtoull _strtoui64
64 +#define strtof strtod
69 #include "util/util.h"
70 #include "util/flags.h"
71 @@ -31,10 +37,22 @@ const VariadicFunction2<bool, const StringPiece&, const RE2&, RE2::Arg, RE2::Par
72 const VariadicFunction2<bool, StringPiece*, const RE2&, RE2::Arg, RE2::ConsumeN> RE2::Consume;
73 const VariadicFunction2<bool, StringPiece*, const RE2&, RE2::Arg, RE2::FindAndConsumeN> RE2::FindAndConsume;
75 -// This will trigger LNK2005 error in MSVC.
76 -#ifndef COMPILER_MSVC
77 -const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
78 -#endif // COMPILER_MSVC
79 +#define kDefaultMaxMem (8<<20)
81 +RE2::Options::Options()
82 + : encoding_(EncodingUTF8),
83 + posix_syntax_(false),
84 + longest_match_(false),
86 + max_mem_(kDefaultMaxMem),
89 + never_capture_(false),
90 + case_sensitive_(true),
91 + perl_classes_(false),
92 + word_boundary_(false),
96 RE2::Options::Options(RE2::CannedOptions opt)
97 : encoding_(opt == RE2::Latin1 ? EncodingLatin1 : EncodingUTF8),
98 diff --git a/re2/re2.h b/re2/re2.h
99 index 272028b..c509853 100644
102 @@ -552,28 +552,16 @@ class RE2 {
103 // If this happens too often, RE2 falls back on the NFA implementation.
105 // For now, make the default budget something close to Code Search.
107 static const int kDefaultMaxMem = 8<<20;
116 - encoding_(EncodingUTF8),
117 - posix_syntax_(false),
118 - longest_match_(false),
120 - max_mem_(kDefaultMaxMem),
123 - never_capture_(false),
124 - case_sensitive_(true),
125 - perl_classes_(false),
126 - word_boundary_(false),
131 /*implicit*/ Options(CannedOptions);
133 Encoding encoding() const { return encoding_; }
134 diff --git a/re2/stringpiece.h b/re2/stringpiece.h
135 index ab9297c..38a5150 100644
136 --- a/re2/stringpiece.h
137 +++ b/re2/stringpiece.h
143 +#include <algorithm>
148 diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc
149 index b99cacf..911e868 100644
150 --- a/re2/testing/re2_test.cc
151 +++ b/re2/testing/re2_test.cc
153 // TODO: Test extractions for PartialMatch/Consume
155 #include <sys/types.h>
157 #include <sys/mman.h>
159 #include <sys/stat.h>
164 #include "re2/regexp.h"
168 +#define snprintf _snprintf
171 DECLARE_bool(logtostderr);
174 @@ -657,6 +664,7 @@ TEST(RE2, FullMatchTypedNullArg) {
175 CHECK(!RE2::FullMatch("hello", "(.*)", (float*)NULL));
179 // Check that numeric parsing code does not read past the end of
180 // the number being parsed.
181 TEST(RE2, NULTerminated) {
182 @@ -678,6 +686,7 @@ TEST(RE2, NULTerminated) {
183 CHECK(RE2::FullMatch(StringPiece(v + pagesize - 1, 1), "(.*)", &x));
188 TEST(RE2, FullMatchTypeTests) {
190 diff --git a/util/logging.h b/util/logging.h
191 index 4443f7c..d0a2d87 100644
195 #ifndef RE2_UTIL_LOGGING_H__
196 #define RE2_UTIL_LOGGING_H__
199 #include <unistd.h> /* for write */
206 // Debug-only checking.
207 #define DCHECK(condition) assert(condition)
208 diff --git a/util/mutex.h b/util/mutex.h
209 index 9787bfb..e321fae 100644
217 #define HAVE_PTHREAD 1
218 #define HAVE_RWLOCK 1
221 #if defined(NO_THREADS)
222 typedef int MutexType; // to keep a lock-count
223 @@ -32,7 +34,9 @@ namespace re2 {
224 # include <pthread.h>
225 typedef pthread_mutex_t MutexType;
227 -# define WIN32_LEAN_AND_MEAN // We only need minimal includes
228 +# ifndef WIN32_LEAN_AND_MEAN
229 +# define WIN32_LEAN_AND_MEAN // We only need minimal includes
231 # ifdef GMUTEX_TRYLOCK
232 // We need Windows NT or later for TryEnterCriticalSection(). If you
233 // don't need that functionality, you can remove these _WIN32_WINNT
234 diff --git a/util/pcre.cc b/util/pcre.cc
235 index 5e67e1f..1602133 100644
239 #include "util/flags.h"
240 #include "util/pcre.h"
243 +#define strtoll _strtoi64
244 +#define strtoull _strtoui64
247 #define PCREPORT(level) LOG(level)
249 // Default PCRE limits.
250 diff --git a/util/pcre.h b/util/pcre.h
251 index 4dda95d..771ac91 100644
254 @@ -180,9 +180,15 @@ struct pcre_extra { int flags, match_limit, match_limit_recursion; };
255 #define PCRE_ERROR_MATCHLIMIT 2
256 #define PCRE_ERROR_RECURSIONLIMIT 3
257 #define PCRE_INFO_CAPTURECOUNT 0
259 #define pcre_compile(a,b,c,d,e) ({ (void)(a); (void)(b); *(c)=""; *(d)=0; (void)(e); ((pcre*)0); })
260 #define pcre_exec(a, b, c, d, e, f, g, h) ({ (void)(a); (void)(b); (void)(c); (void)(d); (void)(e); (void)(f); (void)(g); (void)(h); 0; })
261 #define pcre_fullinfo(a, b, c, d) ({ (void)(a); (void)(b); (void)(c); *(d) = 0; 0; })
263 +#define pcre_compile(a,b,c,d,e) NULL
264 +#define pcre_exec(a, b, c, d, e, f, g, h) NULL
265 +#define pcre_fullinfo(a, b, c, d) NULL
270 diff --git a/util/test.cc b/util/test.cc
271 index 0644829..2fe1bfa 100644
275 // license that can be found in the LICENSE file.
279 #include <sys/resource.h>
281 #include "util/test.h"
283 DEFINE_string(test_tmpdir, "/var/tmp", "temp directory");
284 @@ -23,9 +25,13 @@ void RegisterTest(void (*fn)(void), const char *name) {
287 int64 VirtualProcessSize() {
290 getrusage(RUSAGE_SELF, &ru);
291 return (int64)ru.ru_maxrss*1024;
298 diff --git a/util/util.h b/util/util.h
299 index c46ab1b..17ef824 100644
303 #include <stddef.h> // For size_t
307 #include <sys/time.h>
310 #include <ctype.h> // For isdigit, isalpha.
312 @@ -51,7 +53,11 @@ using std::tr1::unordered_set;
315 #include <unordered_set>
317 +using std::tr1::unordered_set;
319 using std::unordered_set;
324 diff --git a/util/valgrind.h b/util/valgrind.h
325 index ca10b1a..d097b0c 100644
326 --- a/util/valgrind.h
327 +++ b/util/valgrind.h
328 @@ -4064,6 +4064,7 @@ typedef
329 #endif /* PLAT_ppc64_aix5 */
333 /* ------------------------------------------------------------------ */
334 /* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS. */
336 @@ -4170,7 +4171,7 @@ typedef
337 VG_USERREQ__DISCARD_TRANSLATIONS, \
338 _qzz_addr, _qzz_len, 0, 0, 0); \
343 /* These requests are for getting Valgrind itself to print something.
344 Possibly with a backtrace. This is a really ugly hack. The return value