MCPcopy Create free account
hub / github.com/ElementsProject/lightning / delete_format_hint

Function delete_format_hint

cli/lightning-cli.c:416–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416static 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
438static enum format choose_format(const char *resp,
439 jsmntok_t **toks,

Callers 1

choose_formatFunction · 0.85

Calls 3

json_get_memberFunction · 0.85
json_tok_streqFunction · 0.85
json_tok_removeFunction · 0.85

Tested by

no test coverage detected