MCPcopy Create free account
hub / github.com/apache/brpc / possibly_valid_json

Function possibly_valid_json

tools/rpc_press/json_loader.cpp:76–88  ·  view source on GitHub ↗

Ignore json only with spaces and newline

Source from the content-addressed store, hash-verified

74
75// Ignore json only with spaces and newline
76static bool possibly_valid_json(const butil::IOBuf& json) {
77 butil::IOBufAsZeroCopyInputStream it(json);
78 const void* data = NULL;
79 for (int size = 0; it.Next(&data, &size); ) {
80 for (int i = 0; i < size; ++i) {
81 char c = ((const char*)data)[i];
82 if (!isspace(c) && c != '\n') {
83 return true;
84 }
85 }
86 }
87 return false;
88}
89
90// Separate jsons with closed braces.
91bool JsonLoader::Reader::get_next_json(butil::IOBuf* json1) {

Callers 1

get_next_jsonMethod · 0.85

Calls 1

NextMethod · 0.45

Tested by

no test coverage detected