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

Function json_tok_bin_from_hex

common/json_parse.c:162–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162u8 *json_tok_bin_from_hex(const tal_t *ctx, const char *buffer, const jsmntok_t *tok)
163{
164 u8 *result;
165 size_t hexlen, rawlen;
166 hexlen = tok->end - tok->start;
167 rawlen = hex_data_size(hexlen);
168
169 result = tal_arr(ctx, u8, rawlen);
170 if (!hex_decode(buffer + tok->start, hexlen, result, rawlen))
171 return tal_free(result);
172
173 return result;
174}
175
176/* talfmt take a ctx pointer and return NULL or a valid pointer.
177 * fmt takes the argument, and returns a bool.

Callers 4

param_bin_from_hexFunction · 0.70
param_hops_arrayFunction · 0.70
param_extra_tlvsFunction · 0.70
runtestFunction · 0.50

Calls 3

hex_data_sizeFunction · 0.85
hex_decodeFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected