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

Function json_parse

common/test/run-param.c:103–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static struct json *json_parse(const tal_t * ctx, const char *str)
104{
105 struct json *j = tal(ctx, struct json);
106 j->buffer = tal_strdup(j, str);
107 convert_quotes(j->buffer);
108
109 j->toks = tal_arr(j, jsmntok_t, 50);
110 assert(j->toks);
111 jsmn_parser parser;
112
113 again:
114 jsmn_init(&parser);
115 int ret = jsmn_parse(&parser, j->buffer, strlen(j->buffer), j->toks,
116 tal_count(j->toks));
117 if (ret == JSMN_ERROR_NOMEM) {
118 tal_resize(&j->toks, tal_count(j->toks) * 2);
119 goto again;
120 }
121
122 if (ret <= 0) {
123 assert(0);
124 }
125 return j;
126}
127
128static void zero_params(void)
129{

Callers 13

zero_paramsFunction · 0.70
sanityFunction · 0.70
tok_tokFunction · 0.70
dup_namesFunction · 0.70
null_paramsFunction · 0.70
no_paramsFunction · 0.70
bad_programmerFunction · 0.70
five_hundred_paramsFunction · 0.70
sendpayFunction · 0.70
deprecated_renameFunction · 0.70
sendpay_nulltokFunction · 0.70
advancedFunction · 0.70

Calls 1

convert_quotesFunction · 0.70

Tested by

no test coverage detected