mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 00:54:20 +01:00
json: add json_tok_endswith and json_tok_startswith helpers.
I wanted this for offers, and it's generally useful. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -26,6 +26,14 @@ int json_tok_full_len(const jsmntok_t *t);
|
||||
/* Is this a string equal to str? */
|
||||
bool json_tok_streq(const char *buffer, const jsmntok_t *tok, const char *str);
|
||||
|
||||
/* Does this string token start with prefix? */
|
||||
bool json_tok_startswith(const char *buffer, const jsmntok_t *tok,
|
||||
const char *prefix);
|
||||
|
||||
/* Does this string token end with suffix? */
|
||||
bool json_tok_endswith(const char *buffer, const jsmntok_t *tok,
|
||||
const char *suffix);
|
||||
|
||||
/* Allocate a tal string copy */
|
||||
char *json_strdup(const tal_t *ctx, const char *buffer, const jsmntok_t *tok);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user