Ignore json only with spaces and newline
| 74 | |
| 75 | // Ignore json only with spaces and newline |
| 76 | static 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. |
| 91 | bool JsonLoader::Reader::get_next_json(butil::IOBuf* json1) { |