From e26f433ef65a3ea8bd7b0148c5fb1b2c05a835c6 Mon Sep 17 00:00:00 2001 From: freekeeperlzt Date: Mon, 17 Oct 2022 00:06:17 -0700 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=99=A4=E4=BA=86gitee=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E5=A4=B4=E6=96=87=E4=BB=B6=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E4=BD=BF=E7=94=A8#pragma=20once?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- re2/filtered_re2.h | 5 +---- re2/re2.h | 7 ++----- re2/set.h | 7 ++----- re2/stringpiece.h | 7 ++----- regex-capi/include/rure.h | 7 ++----- util/benchmark.h | 5 +---- util/flags.h | 7 ++----- util/logging.h | 7 ++----- util/malloc_counter.h | 7 ++----- util/mix.h | 7 ++----- util/mutex.h | 7 ++----- util/pcre.h | 5 +---- util/strutil.h | 7 ++----- util/test.h | 5 +---- util/utf.h | 7 ++----- util/util.h | 7 ++----- 16 files changed, 28 insertions(+), 76 deletions(-) diff --git a/re2/filtered_re2.h b/re2/filtered_re2.h index dd618c7..ea5c89f 100644 --- a/re2/filtered_re2.h +++ b/re2/filtered_re2.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef RE2_FILTERED_RE2_H_ -#define RE2_FILTERED_RE2_H_ +#pragma once // The class FilteredRE2 is used as a wrapper to multiple RE2 regexps. // It provides a prefilter mechanism that helps in cutting down the @@ -110,5 +109,3 @@ class FilteredRE2 { }; } // namespace re2 - -#endif // RE2_FILTERED_RE2_H_ diff --git a/re2/re2.h b/re2/re2.h index 7fd2245..1550dc9 100644 --- a/re2/re2.h +++ b/re2/re2.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef RE2_RE2_H_ -#define RE2_RE2_H_ +#pragma once // C++ interface to the re2 regular-expression library. // RE2 supports Perl-style regular expressions (with extensions like @@ -1012,6 +1011,4 @@ DECLARE_HOOK(DFASearchFailure) } // namespace re2 using re2::RE2; -using re2::LazyRE2; - -#endif // RE2_RE2_H_ +using re2::LazyRE2; \ No newline at end of file diff --git a/re2/set.h b/re2/set.h index 8d64f30..5d6ec91 100644 --- a/re2/set.h +++ b/re2/set.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef RE2_SET_H_ -#define RE2_SET_H_ +#pragma once #include #include @@ -80,6 +79,4 @@ class RE2::Set { std::unique_ptr prog_; }; -} // namespace re2 - -#endif // RE2_SET_H_ +} // namespace re2 \ No newline at end of file diff --git a/re2/stringpiece.h b/re2/stringpiece.h index 1d9c2d3..f568876 100644 --- a/re2/stringpiece.h +++ b/re2/stringpiece.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef RE2_STRINGPIECE_H_ -#define RE2_STRINGPIECE_H_ +#pragma once // A string-like object that points to a sized piece of memory. // @@ -205,6 +204,4 @@ inline bool operator>=(const StringPiece& x, const StringPiece& y) { // Allow StringPiece to be logged. std::ostream& operator<<(std::ostream& o, const StringPiece& p); -} // namespace re2 - -#endif // RE2_STRINGPIECE_H_ +} // namespace re2 \ No newline at end of file diff --git a/regex-capi/include/rure.h b/regex-capi/include/rure.h index c8e2af5..f9abf43 100644 --- a/regex-capi/include/rure.h +++ b/regex-capi/include/rure.h @@ -1,5 +1,4 @@ -#ifndef _RURE_H -#define _RURE_H +#pragma once #include #include @@ -616,6 +615,4 @@ bool rure_check_rewrite_string(const char *rewrite, int max_token); #ifdef __cplusplus } -#endif - -#endif +#endif \ No newline at end of file diff --git a/util/benchmark.h b/util/benchmark.h index d97b49e..40181a5 100644 --- a/util/benchmark.h +++ b/util/benchmark.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_BENCHMARK_H_ -#define UTIL_BENCHMARK_H_ +#pragma once #include #include @@ -152,5 +151,3 @@ class Benchmark { #define BENCHMARK_RANGE(f, lo, hi) \ ::testing::Benchmark* _benchmark_##f = \ (new ::testing::Benchmark(#f, f, lo, hi)) - -#endif // UTIL_BENCHMARK_H_ diff --git a/util/flags.h b/util/flags.h index 3386b72..c6d66e3 100644 --- a/util/flags.h +++ b/util/flags.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_FLAGS_H_ -#define UTIL_FLAGS_H_ +#pragma once // Simplified version of Google's command line flags. // Does not support parsing the command line. @@ -21,6 +20,4 @@ template T GetFlag(const T& flag) { return flag; } -} // namespace re2 - -#endif // UTIL_FLAGS_H_ +} // namespace re2 \ No newline at end of file diff --git a/util/logging.h b/util/logging.h index 5b2217f..917b481 100644 --- a/util/logging.h +++ b/util/logging.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_LOGGING_H_ -#define UTIL_LOGGING_H_ +#pragma once // Simplified version of Google's logging. @@ -104,6 +103,4 @@ class LogMessageFatal : public LogMessage { #ifdef _MSC_VER #pragma warning(pop) -#endif - -#endif // UTIL_LOGGING_H_ +#endif \ No newline at end of file diff --git a/util/malloc_counter.h b/util/malloc_counter.h index 81b564f..9beabef 100644 --- a/util/malloc_counter.h +++ b/util/malloc_counter.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_MALLOC_COUNTER_H_ -#define UTIL_MALLOC_COUNTER_H_ +#pragma once namespace testing { class MallocCounter { @@ -14,6 +13,4 @@ class MallocCounter { long long PeakHeapGrowth() { return 0; } void Reset() {} }; -} // namespace testing - -#endif // UTIL_MALLOC_COUNTER_H_ +} // namespace testing \ No newline at end of file diff --git a/util/mix.h b/util/mix.h index d85c172..b8953f0 100644 --- a/util/mix.h +++ b/util/mix.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_MIX_H_ -#define UTIL_MIX_H_ +#pragma once #include #include @@ -36,6 +35,4 @@ class HashMix { #pragma warning(pop) #endif -} // namespace re2 - -#endif // UTIL_MIX_H_ +} // namespace re2 \ No newline at end of file diff --git a/util/mutex.h b/util/mutex.h index 158046b..a5ebc8a 100644 --- a/util/mutex.h +++ b/util/mutex.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_MUTEX_H_ -#define UTIL_MUTEX_H_ +#pragma once /* * A simple mutex wrapper, supporting locks and read-write locks. @@ -143,6 +142,4 @@ class WriterMutexLock { #define ReaderMutexLock(x) static_assert(false, "ReaderMutexLock declaration missing variable name") #define WriterMutexLock(x) static_assert(false, "WriterMutexLock declaration missing variable name") -} // namespace re2 - -#endif // UTIL_MUTEX_H_ +} // namespace re2 \ No newline at end of file diff --git a/util/pcre.h b/util/pcre.h index 896b0bd..7cf2de4 100644 --- a/util/pcre.h +++ b/util/pcre.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_PCRE_H_ -#define UTIL_PCRE_H_ +#pragma once // This is a variant of PCRE's pcrecpp.h, originally written at Google. // The main changes are the addition of the HitLimit method and @@ -677,5 +676,3 @@ MAKE_INTEGER_PARSER(unsigned long long, ulonglong); #undef MAKE_INTEGER_PARSER } // namespace re2 - -#endif // UTIL_PCRE_H_ diff --git a/util/strutil.h b/util/strutil.h index a69908a..e2a7f0b 100644 --- a/util/strutil.h +++ b/util/strutil.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_STRUTIL_H_ -#define UTIL_STRUTIL_H_ +#pragma once #include @@ -16,6 +15,4 @@ std::string CEscape(const StringPiece& src); void PrefixSuccessor(std::string* prefix); std::string StringPrintf(const char* format, ...); -} // namespace re2 - -#endif // UTIL_STRUTIL_H_ +} // namespace re2 \ No newline at end of file diff --git a/util/test.h b/util/test.h index 54e6f8f..e52d883 100644 --- a/util/test.h +++ b/util/test.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_TEST_H_ -#define UTIL_TEST_H_ +#pragma once #include "util/util.h" #include "util/logging.h" @@ -46,5 +45,3 @@ class TestRegisterer { #define EXPECT_LE CHECK_LE #define EXPECT_GT CHECK_GT #define EXPECT_GE CHECK_GE - -#endif // UTIL_TEST_H_ diff --git a/util/utf.h b/util/utf.h index 85b4297..a25f762 100644 --- a/util/utf.h +++ b/util/utf.h @@ -15,8 +15,7 @@ * in name space re2. */ -#ifndef UTIL_UTF_H_ -#define UTIL_UTF_H_ +#pragma once #include @@ -39,6 +38,4 @@ int fullrune(const char* s, int n); int utflen(const char* s); char* utfrune(const char*, Rune); -} // namespace re2 - -#endif // UTIL_UTF_H_ +} // namespace re2 \ No newline at end of file diff --git a/util/util.h b/util/util.h index 56e46c1..78bf84c 100644 --- a/util/util.h +++ b/util/util.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#ifndef UTIL_UTIL_H_ -#define UTIL_UTIL_H_ +#pragma once #define arraysize(array) (sizeof(array)/sizeof((array)[0])) @@ -37,6 +36,4 @@ #ifndef NO_THREAD_SAFETY_ANALYSIS #define NO_THREAD_SAFETY_ANALYSIS -#endif - -#endif // UTIL_UTIL_H_ +#endif \ No newline at end of file -- Gitee