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

Function delete_format_hint

cli/lightning-cli.c:424–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422}
423
424static enum format delete_format_hint(const char *resp, jsmntok_t **toks)
425{
426 const jsmntok_t *result = json_get_member(resp, *toks, "result");
427 const jsmntok_t *hint;
428 enum format format = JSON;
429
430 if (!result)
431 return format;
432
433 hint = json_get_member(resp, result, "format-hint");
434 if (!hint)
435 return format;
436
437 if (json_tok_streq(resp, hint, "simple"))
438 format = HUMAN;
439
440 /* Don't let hint appear in the output! */
441 /* Note the aritmetic on *toks for const-washing */
442 json_tok_remove(toks, *toks + (result - *toks), hint-1, 1);
443 return format;
444}
445
446static enum format choose_format(const char *resp,
447 jsmntok_t **toks,

Callers 1

choose_formatFunction · 0.85

Calls 3

json_tok_removeFunction · 0.85
json_get_memberFunction · 0.50
json_tok_streqFunction · 0.50

Tested by

no test coverage detected