To avoid JSON encoding/decoding, we use hex encoding directly */
| 189 | |
| 190 | /* To avoid JSON encoding/decoding, we use hex encoding directly */ |
| 191 | static char *json_cstr_from_hex(const tal_t *ctx, const char *buffer, const jsmntok_t *tok) |
| 192 | { |
| 193 | char *result; |
| 194 | size_t hexlen, rawlen; |
| 195 | hexlen = tok->end - tok->start; |
| 196 | rawlen = hex_data_size(hexlen); |
| 197 | |
| 198 | result = tal_arr(ctx, char, rawlen + 1); |
| 199 | if (!hex_decode(buffer + tok->start, hexlen, result, rawlen)) |
| 200 | return tal_free(result); |
| 201 | |
| 202 | result[rawlen] = '\0'; |
| 203 | return result; |
| 204 | } |
| 205 | |
| 206 | struct descriptions *init_descriptions(const tal_t *ctx, |
| 207 | struct command *init_cmd) |
no test coverage detected