Commit 340f7d54 authored by Eric Niebler's avatar Eric Niebler Committed by Facebook GitHub Bot

use kIsDebug instead of NDEBUG in checkNullTerminated

Summary: Avoid a needless use of the preprocessor in FixedString.h by using `kIsDebug` instead of the `NDEBUG` preprocessor macro in `checkNullTerminated`.

Reviewed By: yfeldblum

Differential Revision: D23411248

fbshipit-source-id: 78990ade25bcfa3956f917b2b285c096b76ecb09
parent 08e26148
......@@ -96,10 +96,8 @@ template <class Char, std::size_t N>
constexpr const Char (&checkNullTerminated(const Char (&a)[N]) noexcept)[N] {
// Strange decltype(a)(a) used to make MSVC happy.
return a[N - 1u] == Char(0)
#ifndef NDEBUG
// In Debug mode, guard against embedded nulls:
&& N - 1u == folly::constexpr_strlen(a)
#endif
&& (!kIsDebug || N - 1u == folly::constexpr_strlen(a))
? decltype(a)(a)
: (assertNotNullTerminated(), decltype(a)(a));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment