mirror of
https://github.com/nlohmann/json.git
synced 2026-10-24 23:08:56 +00:00
Fix the compiler and lint findings of json_view's read side and tests
- find() and contains() dispatch on Editable for the member lookup; for documents that cannot be edited both branches were the same call (GCC -Wduplicated-branches) - json_view.hpp includes <cstdio> for the FILE overload (cpplint) - the arena check macro of the builder is on one line (cpplint read it as an if body without braces) - tests: no nested conditional (also MSVC C4018), no useless cast, parentheses around mixed operators, raw string literals, += instead of temporary concatenations, and NOLINT for the fixed seeds and a find() != npos, as elsewhere in the tests Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
5 files changed
+71
-35
No files matched your search
@@ -283,14 +283,8 @@ class builder
|
||||
const std::size_t start = arena_used();
|
||||
char* w = m_arena_write;
|
||||
const char* w_end = m_arena_end;
|
||||
#define NLOHMANN_VIEW_ENSURE(n) \
|
||||
if (NLOHMANN_VIEW_UNLIKELY(static_cast<std::size_t>(w_end - w) < (n))) \
|
||||
{ \
|
||||
m_arena_write = w; \
|
||||
arena_grow(n); \
|
||||
w = m_arena_write; \
|
||||
w_end = m_arena_end; \
|
||||
}
|
||||
#define NLOHMANN_VIEW_ENSURE(n) \
|
||||
if (NLOHMANN_VIEW_UNLIKELY(static_cast<std::size_t>(w_end - w) < (n))) { m_arena_write = w; arena_grow(n); w = m_arena_write; w_end = m_arena_end; }
|
||||
{
|
||||
const auto n = static_cast<std::size_t>(p - s);
|
||||
if (n <= 16 && end - s >= 16)
|
||||
|
||||
Reference in new issue
Block a user