| 414 | } |
| 415 | |
| 416 | static enum format delete_format_hint(const char *resp, jsmntok_t **toks) |
| 417 | { |
| 418 | const jsmntok_t *result = json_get_member(resp, *toks, "result"); |
| 419 | const jsmntok_t *hint; |
| 420 | enum format format = JSON; |
| 421 | |
| 422 | if (!result) |
| 423 | return format; |
| 424 | |
| 425 | hint = json_get_member(resp, result, "format-hint"); |
| 426 | if (!hint) |
| 427 | return format; |
| 428 | |
| 429 | if (json_tok_streq(resp, hint, "simple")) |
| 430 | format = HUMAN; |
| 431 | |
| 432 | /* Don't let hint appear in the output! */ |
| 433 | /* Note the aritmetic on *toks for const-washing */ |
| 434 | json_tok_remove(toks, *toks + (result - *toks), hint-1, 1); |
| 435 | return format; |
| 436 | } |
| 437 | |
| 438 | static enum format choose_format(const char *resp, |
| 439 | jsmntok_t **toks, |
no test coverage detected