Duh.
This commit is contained in:
parent
a6e4933d93
commit
45e2178ada
|
@ -180,7 +180,7 @@ In some cases, you may have valid JSON strings that you do not wish to parse but
|
|||
size_t length = strlen(some_string);
|
||||
// Create a buffer to receive the minified string. Make sure that there is enough room,
|
||||
// including some padding (simdjson::SIMDJSON_PADDING).
|
||||
std::unique_ptr<char> buffer{new(std::nothrow) char[length + simdjson::SIMDJSON_PADDING]};
|
||||
std::unique_ptr<char[]> buffer{new(std::nothrow) char[length + simdjson::SIMDJSON_PADDING]};
|
||||
size_t new_length{}; // It will receive the minified length.
|
||||
auto error = simdjson::minify_string(some_string, length, buffer.get(), new_length);
|
||||
// The buffer variable now has "[1,2,3,4]" and new_length has value 9.
|
||||
|
|
|
@ -1717,7 +1717,7 @@ namespace type_tests {
|
|||
namespace minify_string_tests {
|
||||
|
||||
bool check_minification(const char * input, size_t length, const char * expected, size_t expected_length) {
|
||||
std::unique_ptr<char> buffer{new(std::nothrow) char[length + simdjson::SIMDJSON_PADDING]};
|
||||
std::unique_ptr<char[]> buffer{new(std::nothrow) char[length + simdjson::SIMDJSON_PADDING]};
|
||||
if(buffer.get() == nullptr) {
|
||||
std::cerr << "cannot alloc " << std::endl;
|
||||
return false;
|
||||
|
|
|
@ -242,7 +242,7 @@ SIMDJSON_POP_DISABLE_WARNINGS
|
|||
void minify_string() {
|
||||
const char * some_string = "[ 1, 2, 3, 4] ";
|
||||
size_t length = strlen(some_string);
|
||||
std::unique_ptr<char> buffer{new(std::nothrow) char[length + simdjson::SIMDJSON_PADDING]};
|
||||
std::unique_ptr<char[]> buffer{new(std::nothrow) char[length + simdjson::SIMDJSON_PADDING]};
|
||||
size_t new_length{};
|
||||
auto error = simdjson::minify_string(some_string, length, buffer.get(), new_length);
|
||||
if(error != simdjson::SUCCESS) {
|
||||
|
|
Loading…
Reference in New Issue