mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
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:
@@ -12,7 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
const char *json_tok_contents(const char *buffer, const jsmntok_t *t)
|
||||
const char *json_tok_full(const char *buffer, const jsmntok_t *t)
|
||||
{
|
||||
if (t->type == JSMN_STRING)
|
||||
return buffer + t->start - 1;
|
||||
@@ -20,7 +20,7 @@ const char *json_tok_contents(const char *buffer, const jsmntok_t *t)
|
||||
}
|
||||
|
||||
/* Include " if it's a string. */
|
||||
int json_tok_len(const jsmntok_t *t)
|
||||
int json_tok_full_len(const jsmntok_t *t)
|
||||
{
|
||||
if (t->type == JSMN_STRING)
|
||||
return t->end - t->start + 2;
|
||||
|
||||
Reference in New Issue
Block a user