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

Function json_stream_forward_change_id

lightningd/plugin.c:1187–1208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1185}
1186
1187static void json_stream_forward_change_id(struct json_stream *stream,
1188 const char *buffer,
1189 const jsmntok_t *toks,
1190 const jsmntok_t *idtok,
1191 /* Full token, including "" */
1192 const char *new_id)
1193{
1194 /* We copy everything, but replace the id. Special care has to
1195 * be taken when the id that is being replaced is a string. If
1196 * we don't crop the quotes off we'll transform a numeric
1197 * new_id into a string, or even worse, quote a string id
1198 * twice. */
1199 const char *id_start, *id_end;
1200
1201 id_start = json_tok_full(buffer, idtok);
1202 id_end = id_start + json_tok_full_len(idtok);
1203
1204 json_stream_append(stream, buffer + toks->start,
1205 id_start - (buffer + toks->start));
1206 json_stream_append(stream, new_id, strlen(new_id));
1207 json_stream_append(stream, id_end, (buffer + toks->end) - id_end);
1208}
1209
1210static void plugin_rpcmethod_cb(const char *buffer,
1211 const jsmntok_t *toks,

Callers 4

plugin_rpcmethod_cbFunction · 0.85
plugin_notify_cbFunction · 0.85
plugin_rpcmethod_checkFunction · 0.85

Calls 3

json_stream_appendFunction · 0.85
json_tok_fullFunction · 0.50
json_tok_full_lenFunction · 0.50

Tested by

no test coverage detected