diff --git a/include/simdjson/numberparsing.h b/include/simdjson/numberparsing.h index 0ca02eaa..68fa28b3 100644 --- a/include/simdjson/numberparsing.h +++ b/include/simdjson/numberparsing.h @@ -257,7 +257,7 @@ parse_float(const uint8_t *const buf, } i *= power_of_ten[308 + exponent]; } - if(is_not_structural_or_whitespace(*p) != 0u) { + if(is_not_structural_or_whitespace(*p)) { return false; } double d = negative ? -i : i; @@ -265,7 +265,7 @@ parse_float(const uint8_t *const buf, #ifdef JSON_TEST_NUMBERS // for unit testing foundFloat(d, buf + offset); #endif - return is_structural_or_whitespace(*p) != 0u; + return is_structural_or_whitespace(*p); } // called by parse_number when we know that the output is an integer, @@ -336,7 +336,7 @@ static never_inline bool parse_large_integer(const uint8_t *const buf, #ifdef JSON_TEST_NUMBERS // for unit testing foundInteger(signed_answer, buf + offset); #endif - return is_structural_or_whitespace(*p) != 0u; + return is_structural_or_whitespace(*p); } @@ -513,7 +513,7 @@ static really_inline bool parse_number(const uint8_t *const buf, foundInteger(i, buf + offset); #endif } - return is_structural_or_whitespace(*p) != 0u; + return is_structural_or_whitespace(*p); #endif // SIMDJSON_SKIPNUMBERPARSING } diff --git a/include/simdjson/parsedjson.h b/include/simdjson/parsedjson.h index d0f564f3..1b39c3a7 100644 --- a/include/simdjson/parsedjson.h +++ b/include/simdjson/parsedjson.h @@ -238,14 +238,14 @@ private : // dump bits low to high inline void dumpbits_always(uint64_t v, const std::string &msg) { for (uint32_t i = 0; i < 64; i++) { - std::cout << (((v >> static_cast(i)) & 0x1ULL) != 0u ? "1" : "_"); + std::cout << (((v >> static_cast(i)) & 0x1ULL) ? "1" : "_"); } std::cout << " " << msg.c_str() << "\n"; } inline void dumpbits32_always(uint32_t v, const std::string &msg) { for (uint32_t i = 0; i < 32; i++) { - std::cout << (((v >> i) & 0x1ULL) != 0u ? "1" : "_"); + std::cout << (((v >> i) & 0x1ULL) ? "1" : "_"); } std::cout << " " << msg.c_str() << "\n"; } diff --git a/include/simdjson/portability.h b/include/simdjson/portability.h index 936ddb1b..20b51065 100644 --- a/include/simdjson/portability.h +++ b/include/simdjson/portability.h @@ -86,8 +86,7 @@ static inline void *aligned_malloc(size_t alignment, size_t size) { #else // somehow, if this is used before including "x86intrin.h", it creates an // implicit defined warning. - if (posix_memalign(&p, alignment, size) != 0) { return nullptr; -} + if (posix_memalign(&p, alignment, size) != 0) { return nullptr; } #endif return p; } @@ -115,8 +114,7 @@ static inline void _mm256_storeu2_m128i(__m128i *__addr_hi, __m128i *__addr_lo, static inline void aligned_free(void *memblock) { - if(memblock == nullptr) { return; -} + if(memblock == nullptr) { return; } #ifdef _MSC_VER _aligned_free(memblock); #elif defined(__MINGW32__) || defined(__MINGW64__) diff --git a/src/parsedjson.cpp b/src/parsedjson.cpp index 1ce25fb8..a2c2375c 100644 --- a/src/parsedjson.cpp +++ b/src/parsedjson.cpp @@ -62,16 +62,12 @@ bool ParsedJson::allocateCapacity(size_t len, size_t maxdepth) { if ((string_buf == nullptr) || (tape == nullptr) || (containing_scope_offset == nullptr) || (ret_address == nullptr) || (structural_indexes == nullptr)) { std::cerr << "Could not allocate memory" << std::endl; - {delete[] ret_address; -} - {delete[] containing_scope_offset; -} - {delete[] tape; -} - {delete[] string_buf; -} - {delete[] structural_indexes; -} + delete[] ret_address; + delete[] containing_scope_offset; + delete[] tape; + delete[] string_buf; + delete[] structural_indexes; + return false; }