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

Function json_stream_double_cr

common/json_stream.c:98–117  ·  view source on GitHub ↗

We promise it will end in '\n\n' */

Source from the content-addressed store, hash-verified

96
97/* We promise it will end in '\n\n' */
98void json_stream_double_cr(struct json_stream *js)
99{
100 const char *contents;
101 size_t len, cr_needed;
102
103 /* Must be well-formed at this point! */
104 json_out_finished(js->jout);
105
106 contents = json_out_contents(js->jout, &len);
107 /* It's an object (with an id!): definitely can't be less that "{}" */
108 assert(len >= 2);
109 if (contents[len-1] == '\n') {
110 if (contents[len-2] == '\n')
111 return;
112 cr_needed = 1;
113 } else
114 cr_needed = 2;
115
116 json_stream_append(js, "\n\n", cr_needed);
117}
118
119void json_stream_close(struct json_stream *js, struct command *writer)
120{

Callers 6

plugin_rpcmethod_cbFunction · 0.85
plugin_notify_cbFunction · 0.85
plugin_rpcmethod_checkFunction · 0.85
json_notify_fmtFunction · 0.85
json_stream_closeFunction · 0.85

Calls 3

json_out_finishedFunction · 0.85
json_out_contentsFunction · 0.85
json_stream_appendFunction · 0.85

Tested by

no test coverage detected