From f2e1d893132ae85f4e0fdc1e1f6358ea77e22e66 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Mon, 25 May 2026 19:14:52 +0100 Subject: [PATCH] runtime: update iterator usage --- bshell.runtime/command/command.c | 4 ++-- bshell.runtime/format/table.c | 12 ++++++------ bshell.runtime/runtime/pipeline.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bshell.runtime/command/command.c b/bshell.runtime/command/command.c index 13b53c5..48bf6d7 100644 --- a/bshell.runtime/command/command.c +++ b/bshell.runtime/command/command.c @@ -156,12 +156,12 @@ bshell_command *bshell_command_find_static(const char *name) fx_foreach(asm_v, assemblies) { fx_assembly *assembly = NULL; - fx_value_get_object(&asm_v, &assembly); + fx_value_get_object(asm_v, &assembly); fx_iterator *types = fx_assembly_get_types(assembly); fx_foreach(v, types) { fx_type *ty = NULL; - fx_value_get_object(&v, &ty); + fx_value_get_object(v, &ty); if (fx_type_id_compare( fx_type_get_id(ty), BSHELL_TYPE_COMMAND) diff --git a/bshell.runtime/format/table.c b/bshell.runtime/format/table.c index a11ef22..f126984 100644 --- a/bshell.runtime/format/table.c +++ b/bshell.runtime/format/table.c @@ -59,7 +59,7 @@ enum bshell_status format_object_table(fx_object *object, fx_stream *dest) struct bshell_table_ctx ctx; bshell_table_ctx_init(&ctx, dest); - fx_iterator *it = fx_iterator_begin(object); + const fx_iterator *it = fx_iterator_begin(object); if (!it) { bshell_table_ctx_prepare_columns_from_format( &ctx, @@ -68,17 +68,17 @@ enum bshell_status format_object_table(fx_object *object, fx_stream *dest) bshell_table_ctx_print_headers(&ctx); bshell_table_ctx_print_record(&ctx, &FX_VALUE_OBJECT(object)); } else { - fx_value first = fx_iterator_get_value(it); - if (first.v_type) { + const fx_value *first = fx_iterator_get_value(it); + if (first) { bshell_table_ctx_prepare_columns_from_format( &ctx, - fx_type_get_by_id(first.v_type), + fx_type_get_by_id(first->v_type), fmt); } bshell_table_ctx_print_headers(&ctx); fx_foreach(value, it) { - bshell_table_ctx_print_record(&ctx, &value); + bshell_table_ctx_print_record(&ctx, value); } } @@ -188,7 +188,7 @@ enum bshell_status bshell_table_ctx_prepare_columns_from_object( fx_iterator *it = fx_type_get_properties(record_type); fx_foreach(prop_v, it) { - fx_array_push_back(properties, prop_v); + fx_array_push_back(properties, *prop_v); } fx_iterator_unref(it); diff --git a/bshell.runtime/runtime/pipeline.c b/bshell.runtime/runtime/pipeline.c index 7a0a5d2..dc41c1b 100644 --- a/bshell.runtime/runtime/pipeline.c +++ b/bshell.runtime/runtime/pipeline.c @@ -56,10 +56,10 @@ static enum bshell_status write_value( return BSHELL_SUCCESS; } - fx_iterator *it = fx_iterator_begin(container); + const fx_iterator *it = fx_iterator_begin(container); fx_foreach(v, it) { - fx_array_push_back(dest, fx_value_copy_return(v)); + fx_array_push_back(dest, fx_value_ref_copy_return(v)); } fx_iterator_unref(it);