We promise it will end in '\n\n' */
| 89 | |
| 90 | /* We promise it will end in '\n\n' */ |
| 91 | void 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 | |
| 112 | void json_stream_close(struct json_stream *js, struct command *writer) |
| 113 | { |
no test coverage detected