diff --git a/include/simdjson/parsedjson.h b/include/simdjson/parsedjson.h index 407422ae6..a4457d77a 100644 --- a/include/simdjson/parsedjson.h +++ b/include/simdjson/parsedjson.h @@ -1,9 +1,8 @@ #ifndef SIMDJSON_PARSEDJSON_H #define SIMDJSON_PARSEDJSON_H -#include -#include -#include +#include +#include #include #include @@ -227,11 +226,8 @@ private: bool isvalid; private : - - // we don't want the default constructor to be called - ParsedJson(const ParsedJson & p); // we don't want the default constructor to be called - // we don't want the assignment to be called - ParsedJson & operator=(const ParsedJson&o); + ParsedJson(const ParsedJson & p) = delete; + ParsedJson & operator=(const ParsedJson&o) = delete; }; diff --git a/src/parsedjson.cpp b/src/parsedjson.cpp index 5efcfa110..9c44291c6 100644 --- a/src/parsedjson.cpp +++ b/src/parsedjson.cpp @@ -48,16 +48,16 @@ bool ParsedJson::allocateCapacity(size_t len, size_t maxdepth) { bytecapacity = 0; // will only set it to len after allocations are a success n_structural_indexes = 0; uint32_t max_structures = ROUNDUP_N(len, 64) + 2 + 7; - structural_indexes = new uint32_t[max_structures]; + structural_indexes = new (std::nothrow) uint32_t[max_structures]; size_t localtapecapacity = ROUNDUP_N(len, 64); size_t localstringcapacity = ROUNDUP_N(len + 32, 64); - string_buf = new uint8_t[localstringcapacity]; - tape = new uint64_t[localtapecapacity]; - containing_scope_offset = new uint32_t[maxdepth]; + string_buf = new (std::nothrow) uint8_t[localstringcapacity]; + tape = new (std::nothrow) uint64_t[localtapecapacity]; + containing_scope_offset = new (std::nothrow) uint32_t[maxdepth]; #ifdef SIMDJSON_USE_COMPUTED_GOTO - ret_address = new void *[maxdepth]; + ret_address = new (std::nothrow) void *[maxdepth]; #else - ret_address = new char[maxdepth]; + ret_address = new (std::nothrow) char[maxdepth]; #endif if ((string_buf == NULL) || (tape == NULL) || (containing_scope_offset == NULL) || (ret_address == NULL) || (structural_indexes == NULL)) {