json_tok_len, json_tok_contents: rename to json_tok_full_len and json_tok_full

These are only supposed to be used when you want the token contents including
surrounding "".  We should use this when reporting errors, but usually
we just want to access the tok members directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-12-16 15:18:06 +10:30
parent 465d5d5649
commit 12731c4a60
12 changed files with 32 additions and 32 deletions

View File

@@ -363,7 +363,7 @@ int main(int argc, char *argv[])
if (!json_tok_streq(resp, id, idstr))
errx(ERROR_TALKING_TO_LIGHTNINGD,
"Incorrect 'id' in response: %.*s",
json_tok_len(id), json_tok_contents(resp, id));
json_tok_full_len(id), json_tok_full(resp, id));
if (!error || json_tok_is_null(resp, error)) {
// if we have specific help command
@@ -374,8 +374,8 @@ int main(int argc, char *argv[])
human_readable(resp, result, '\n');
else
printf("%.*s\n",
json_tok_len(result),
json_tok_contents(resp, result));
json_tok_full_len(result),
json_tok_full(resp, result));
tal_free(lightning_dir);
tal_free(rpc_filename);
tal_free(ctx);
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
}
printf("%.*s\n",
json_tok_len(error), json_tok_contents(resp, error));
json_tok_full_len(error), json_tok_full(resp, error));
tal_free(lightning_dir);
tal_free(rpc_filename);
tal_free(ctx);