struct tstring * tstring_hex(const char *hex) { struct tstring *s; unsigned length = decode_hex_length(hex); s = tstring_alloc(length); decode_hex(s->data, hex); return s; }
//------------------------------------------------------------------------------ uint8_t * decode_hex_dup(const char *hex) //------------------------------------------------------------------------------ { uint8_t *p; unsigned length = decode_hex_length(hex); p = malloc(length * sizeof(uint8_t)); if (decode_hex(p, hex)) return p; else { free(p); return NULL; } }