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

Function json_parse

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

Source from the content-addressed store, hash-verified

145}
146
147static struct json *json_parse(const tal_t * ctx, const char *str)
148{
149 struct json *j = tal(ctx, struct json);
150 j->buffer = tal_strdup(j, str);
151 convert_quotes(j->buffer);
152
153 j->toks = tal_arr(j, jsmntok_t, 50);
154 assert(j->toks);
155 jsmn_parser parser;
156
157 again:
158 jsmn_init(&parser);
159 int ret = jsmn_parse(&parser, j->buffer, strlen(j->buffer), j->toks,
160 tal_count(j->toks));
161 if (ret == JSMN_ERROR_NOMEM) {
162 tal_resize(&j->toks, tal_count(j->toks) * 2);
163 goto again;
164 }
165
166 if (ret <= 0) {
167 assert(0);
168 }
169 return j;
170}
171
172static void zero_params(void)
173{

Callers 12

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
sendpay_nulltokFunction · 0.70
advancedFunction · 0.70
advanced_failFunction · 0.70

Calls 1

convert_quotesFunction · 0.70

Tested by

no test coverage detected