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

Function json_stream_double_cr

common/json_stream.c:91–110  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 5

plugin_rpcmethod_cbFunction · 0.85
plugin_notify_cbFunction · 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