runtime: move value formatting functionality to a dedicated api
This commit is contained in:
@@ -21,17 +21,10 @@ static void format_value_fallback(const fx_value *value, fx_stream *dest)
|
||||
|
||||
enum bshell_status format_value_default(const fx_value *value, fx_stream *dest)
|
||||
{
|
||||
if (fx_type_is_value_type(value->v_type)) {
|
||||
format_value_fallback(value, dest);
|
||||
return BSHELL_SUCCESS;
|
||||
}
|
||||
|
||||
fx_object *object = NULL;
|
||||
fx_value_get_object(value, &object);
|
||||
enum bshell_status status = format_object_table(object, dest);
|
||||
if (status != BSHELL_SUCCESS) {
|
||||
format_value_fallback(value, dest);
|
||||
}
|
||||
struct bshell_value_writer writer;
|
||||
bshell_value_writer_init(&writer, dest);
|
||||
bshell_value_writer_write(&writer, value);
|
||||
bshell_value_writer_cleanup(&writer);
|
||||
|
||||
return BSHELL_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user