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

Function new_cond_info

plugins/commando.c:240–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238};
239
240static struct cond_info *new_cond_info(const tal_t *ctx,
241 struct commando *incoming,
242 const jsmntok_t *toks STEALS,
243 const jsmntok_t *method,
244 const jsmntok_t *params,
245 const jsmntok_t *id,
246 const jsmntok_t *filter)
247{
248 struct cond_info *cinfo = tal(ctx, struct cond_info);
249
250 cinfo->incoming = incoming;
251 /* Convenience pointer, since contents is u8 */
252 cinfo->buf = cast_signed(const char *, incoming->contents);
253 cinfo->toks = tal_steal(cinfo, toks);
254 cinfo->method = method;
255 cinfo->params = params;
256 cinfo->filter = filter;
257
258 if (!id) {
259 cinfo->cmdid_prefix = NULL;
260 incoming->json_id = NULL;
261 } else {
262 cinfo->cmdid_prefix = json_strdup(cinfo, cinfo->buf, id);
263 /* Includes quotes, if any! */
264 incoming->json_id = tal_strndup(incoming,
265 json_tok_full(cinfo->buf, id),
266 json_tok_full_len(id));
267 }
268 return cinfo;
269}
270
271static struct command_result *execute_command(struct command *cmd,
272 struct cond_info *cinfo)

Callers 1

try_commandFunction · 0.85

Calls 3

json_strdupFunction · 0.50
json_tok_fullFunction · 0.50
json_tok_full_lenFunction · 0.50

Tested by

no test coverage detected