Append to commando->contents: set to NULL if we've over max. */
| 90 | |
| 91 | /* Append to commando->contents: set to NULL if we've over max. */ |
| 92 | static void append_contents(struct commando *commando, const u8 *msg, size_t msglen, |
| 93 | size_t maxlen) |
| 94 | { |
| 95 | size_t len = tal_count(commando->contents); |
| 96 | |
| 97 | if (!commando->contents) |
| 98 | return; |
| 99 | |
| 100 | if (len + msglen > maxlen) { |
| 101 | commando->contents = tal_free(commando->contents); |
| 102 | return; |
| 103 | } |
| 104 | |
| 105 | tal_arr_appendn(&commando->contents, msg, msglen); |
| 106 | } |
| 107 | |
| 108 | struct reply { |
| 109 | struct commando *incoming; |
no test coverage detected