mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Apply minor readability fixes
This commit is contained in:
+10
-7
@@ -7,10 +7,10 @@
|
||||
#endif
|
||||
|
||||
|
||||
extern bool json_parse(const char * buf, size_t len, ParsedJson &pj, bool reallocifneeded);
|
||||
extern bool json_parse(const std::string_view &s, ParsedJson &pj, bool reallocifneeded);
|
||||
extern ParsedJson build_parsed_json(const char * buf, size_t len, bool reallocifneeded);
|
||||
extern ParsedJson build_parsed_json(const std::string_view &s, bool reallocifneeded);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// parse a document found in buf, need to preallocate ParsedJson.
|
||||
@@ -34,7 +34,8 @@ bool json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, bool reallocifne
|
||||
if ( (reinterpret_cast<uintptr_t>(buf + len - 1) % pagesize ) < SIMDJSON_PADDING ) {
|
||||
const uint8_t *tmpbuf = buf;
|
||||
buf = (uint8_t *) allocate_padded_buffer(len);
|
||||
if(buf == NULL) return false;
|
||||
if(buf == nullptr) { return false;
|
||||
}
|
||||
memcpy((void*)buf,tmpbuf,len);
|
||||
reallocated = true;
|
||||
}
|
||||
@@ -43,10 +44,12 @@ bool json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, bool reallocifne
|
||||
if (isok) {
|
||||
isok = unified_machine(buf, len, pj);
|
||||
} else {
|
||||
if(reallocated) free((void*)buf);
|
||||
if(reallocated) { free((void*)buf);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(reallocated) free((void*)buf);
|
||||
if(reallocated) { free((void*)buf);
|
||||
}
|
||||
return isok;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user