| 454 | } |
| 455 | |
| 456 | static void parse_root_object(JsonObject &obj, const char *json) |
| 457 | { |
| 458 | if (json == NULL) { |
| 459 | fatal("json is NULL"); |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | while (*json) { |
| 464 | const char *key_begin = *json == '"' ? (json + 1) : json; |
| 465 | |
| 466 | TempAllocator256 ta; |
| 467 | DynamicString key(ta); |
| 468 | json = parse_key(json, key); |
| 469 | if (json == NULL) |
| 470 | return; |
| 471 | |
| 472 | StringView fs_key(key_begin, key.length()); |
| 473 | |
| 474 | json = skip_spaces(json); |
| 475 | if (json == NULL) |
| 476 | return; |
| 477 | NEXT_OR_RETURN(json, (*json == '=') ? '=' : ':', /*void*/); |
| 478 | json = skip_spaces(json); |
| 479 | if (json == NULL) |
| 480 | return; |
| 481 | |
| 482 | hash_map::set(obj._map, fs_key, json); |
| 483 | |
| 484 | json = skip_value(json); |
| 485 | if (json == NULL) |
| 486 | return; |
| 487 | |
| 488 | json = skip_spaces(json); |
| 489 | if (json == NULL) |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | obj._end = json + 1; |
| 494 | } |
| 495 | |
| 496 | void parse_object(JsonObject &obj, const char *json) |
| 497 | { |
no test coverage detected