summaryrefslogtreecommitdiff
path: root/absl/strings/string_view.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/string_view.h')
-rw-r--r--absl/strings/string_view.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/absl/strings/string_view.h b/absl/strings/string_view.h
index 5dd08b3a..033509ad 100644
--- a/absl/strings/string_view.h
+++ b/absl/strings/string_view.h
@@ -482,21 +482,21 @@ class string_view {
static constexpr size_type kMaxSize =
std::numeric_limits<size_type>::max() / 2 + 1;
- static constexpr size_type StrLenInternal(const char* str) {
- return str ?
-// check whether __builtin_strlen is provided by the compiler.
-// GCC doesn't have __has_builtin()
-// (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970),
-// but has __builtin_strlen according to
-// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Other-Builtins.html.
+ // check whether __builtin_strlen is provided by the compiler.
+ // GCC doesn't have __has_builtin()
+ // (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970),
+ // but has __builtin_strlen according to
+ // https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Other-Builtins.html.
#if ABSL_HAVE_BUILTIN(__builtin_strlen) || \
(defined(__GNUC__) && !defined(__clang__))
- __builtin_strlen(str)
+ static constexpr size_type StrLenInternal(const char* str) {
+ return str ? __builtin_strlen(str) : 0;
+ }
#else
- strlen(str)
-#endif
- : 0;
+ static constexpr size_type StrLenInternal(const char* str) {
+ return str ? strlen(str) : 0;
}
+#endif
static constexpr size_type CheckLengthInternal(size_type len) {
return ABSL_ASSERT(len <= kMaxSize), len;