mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
e370a65383
* Improving portability. * Revisiting faulty logic regarding same-page overruns. * Disabling same-page overruns under VS. * Clarifying the documentation * Fix for issue 131 + being more explicit regarding memory realloc. * Fix for issue 137. * removing "using namespace std" throughout. Fix for 50 * Introducing typed malloc/free. * Introducing a custom class (padded_string) that solves several minor usability issues. * Updating amalgamation for testing.
21 lines
499 B
C++
21 lines
499 B
C++
#include <iostream>
|
|
#include "../singleheader/simdjson.h"
|
|
|
|
int main() {
|
|
const char * filename = JSON_TEST_PATH;
|
|
padded_string p = get_corpus(filename);
|
|
ParsedJson pj = build_parsed_json(p); // do the parsing
|
|
if( ! pj.isValid() ) {
|
|
return EXIT_FAILURE;
|
|
}
|
|
if( ! pj.allocateCapacity(p.size()) ) {
|
|
return EXIT_FAILURE;
|
|
}
|
|
const int res = json_parse(p, pj);
|
|
if (res) {
|
|
std::cerr << simdjson::errorMsg(res) << std::endl;
|
|
return EXIT_FAILURE;
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|