core: update iterator usage
This commit is contained in:
@@ -40,13 +40,13 @@ static enum bshell_status process_record(
|
|||||||
return BSHELL_SUCCESS;
|
return BSHELL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
fx_iterator *aliases = fx_iterator_begin(rt->rt_aliases);
|
const fx_iterator *aliases = fx_iterator_begin(rt->rt_aliases);
|
||||||
fx_foreach(item_v, aliases)
|
fx_foreach(item_v, aliases)
|
||||||
{
|
{
|
||||||
fx_hashtable_item *item;
|
fx_hashtable_item *item;
|
||||||
fx_value_get_object(&item_v, &item);
|
fx_value_get_object(item_v, &item);
|
||||||
fx_value alias_v = fx_hashtable_item_get_value(item);
|
const fx_value *alias_v = fx_hashtable_item_get_value(item);
|
||||||
bshell_pipeline_write_value(pipeline, alias_v, false);
|
bshell_pipeline_write_value(pipeline, *alias_v, false);
|
||||||
}
|
}
|
||||||
fx_iterator_unref(aliases);
|
fx_iterator_unref(aliases);
|
||||||
|
|
||||||
@@ -55,13 +55,14 @@ static enum bshell_status process_record(
|
|||||||
while (scope) {
|
while (scope) {
|
||||||
fx_hashtable *function_map
|
fx_hashtable *function_map
|
||||||
= bshell_runtime_scope_get_functions(scope);
|
= bshell_runtime_scope_get_functions(scope);
|
||||||
fx_iterator *functions = fx_iterator_begin(function_map);
|
const fx_iterator *functions = fx_iterator_begin(function_map);
|
||||||
fx_foreach(item_v, functions)
|
fx_foreach(item_v, functions)
|
||||||
{
|
{
|
||||||
fx_hashtable_item *item;
|
fx_hashtable_item *item;
|
||||||
fx_value_get_object(&item_v, &item);
|
fx_value_get_object(item_v, &item);
|
||||||
fx_value func_v = fx_hashtable_item_get_value(item);
|
const fx_value *func_v
|
||||||
bshell_pipeline_write_value(pipeline, func_v, false);
|
= fx_hashtable_item_get_value(item);
|
||||||
|
bshell_pipeline_write_value(pipeline, *func_v, false);
|
||||||
}
|
}
|
||||||
fx_iterator_unref(functions);
|
fx_iterator_unref(functions);
|
||||||
|
|
||||||
@@ -72,12 +73,12 @@ static enum bshell_status process_record(
|
|||||||
fx_foreach(asm_v, assemblies)
|
fx_foreach(asm_v, assemblies)
|
||||||
{
|
{
|
||||||
fx_assembly *assembly = NULL;
|
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_iterator *types = fx_assembly_get_types(assembly);
|
||||||
fx_foreach(v, types)
|
fx_foreach(v, types)
|
||||||
{
|
{
|
||||||
fx_type *ty = NULL;
|
fx_type *ty = NULL;
|
||||||
fx_value_get_object(&v, &ty);
|
fx_value_get_object(v, &ty);
|
||||||
fx_type_flags ty_flags = fx_type_get_flags(ty);
|
fx_type_flags ty_flags = fx_type_get_flags(ty);
|
||||||
bool is_abstract = (ty_flags & FX_TYPE_F_ABSTRACT) != 0;
|
bool is_abstract = (ty_flags & FX_TYPE_F_ABSTRACT) != 0;
|
||||||
if (is_abstract) {
|
if (is_abstract) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ FX_TYPE_CLASS_DECLARATION_END(bshell_get_verb)
|
|||||||
|
|
||||||
struct bshell_get_verb_p {
|
struct bshell_get_verb_p {
|
||||||
fx_hashtable *c_verbs;
|
fx_hashtable *c_verbs;
|
||||||
fx_iterator *c_it;
|
const fx_iterator *c_it;
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum bshell_status begin_processing(bshell_cmdlet *cmdlet)
|
static enum bshell_status begin_processing(bshell_cmdlet *cmdlet)
|
||||||
@@ -38,18 +38,18 @@ static enum bshell_status process_record(
|
|||||||
= fx_object_get_private(cmdlet, BSHELL_TYPE_GET_VERB);
|
= fx_object_get_private(cmdlet, BSHELL_TYPE_GET_VERB);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fx_value v = fx_iterator_get_value(p->c_it);
|
const fx_value *v = fx_iterator_get_value(p->c_it);
|
||||||
if (!v.v_type) {
|
if (!v) {
|
||||||
return BSHELL_SUCCESS;
|
return BSHELL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
fx_hashtable_item *item = NULL;
|
fx_hashtable_item *item = NULL;
|
||||||
fx_value_get_object(&v, &item);
|
fx_value_get_object(v, &item);
|
||||||
|
|
||||||
v = fx_hashtable_item_get_value(item);
|
v = fx_hashtable_item_get_value(item);
|
||||||
|
|
||||||
bshell_verb *verb = NULL;
|
bshell_verb *verb = NULL;
|
||||||
fx_value_get_object(&v, &verb);
|
fx_value_get_object(v, &verb);
|
||||||
fx_iterator_move_next(p->c_it);
|
fx_iterator_move_next(p->c_it);
|
||||||
|
|
||||||
if (bshell_verb_is_reserved(verb)) {
|
if (bshell_verb_is_reserved(verb)) {
|
||||||
@@ -59,7 +59,7 @@ static enum bshell_status process_record(
|
|||||||
bshell_verb_ref(verb);
|
bshell_verb_ref(verb);
|
||||||
bshell_pipeline_write_value(
|
bshell_pipeline_write_value(
|
||||||
pipeline,
|
pipeline,
|
||||||
fx_value_copy_return(fx_hashtable_item_get_value(item)),
|
fx_value_ref_copy_return(v),
|
||||||
false);
|
false);
|
||||||
break;
|
break;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|||||||
Reference in New Issue
Block a user