static void ofl_msg_print_error(struct ofl_msg_error *msg, FILE *stream) { fprintf(stream, "{type=\""); ofl_error_type_print(stream, msg->type); fprintf(stream, "\", code=\""); ofl_error_code_print(stream, msg->type, msg->code); fprintf(stream, "\", dlen=\"%zu\"}", msg->data_length); }
char * ofl_error_code_to_string(uint16_t type, uint16_t code) { char *str; size_t str_size; FILE *stream = open_memstream(&str, &str_size); ofl_error_code_print(stream, type, code); fclose(stream); return str; }