cleanup: restore the name of a variable

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Luca Guerra <luca.guerra@sysdig.com>
This commit is contained in:
Andrea Terzolo 2024-01-11 15:02:48 +01:00 committed by poiana
parent e601ec2eab
commit a6a1a9769f

View File

@ -435,12 +435,12 @@ static void read_item(
rule_loader::context ctx(item, rule_loader::context::LIST, name, parent); rule_loader::context ctx(item, rule_loader::context::LIST, name, parent);
rule_loader::list_info v(ctx); rule_loader::list_info v(ctx);
bool has_append_flag = false; bool append = false;
decode_val(item, "list", v.name, ctx); decode_val(item, "list", v.name, ctx);
decode_items(item, v.items, ctx); decode_items(item, v.items, ctx);
decode_optional_val(item, "append", has_append_flag, ctx); decode_optional_val(item, "append", append, ctx);
if(has_append_flag) if(append)
{ {
cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx); cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx);
} }
@ -450,13 +450,13 @@ static void read_item(
decode_overrides(item, overridable, overridable, override_append, override_replace, ctx); decode_overrides(item, overridable, overridable, override_append, override_replace, ctx);
bool has_overrides = !override_append.empty() || !override_replace.empty(); bool has_overrides = !override_append.empty() || !override_replace.empty();
THROW(has_append_flag && has_overrides, ERROR_OVERRIDE_APPEND, ctx); THROW(append && has_overrides, ERROR_OVERRIDE_APPEND, ctx);
// Since a list only has items, if we have chosen to append them we can append the entire object // Since a list only has items, if we have chosen to append them we can append the entire object
// otherwise we just want to redefine the list. // otherwise we just want to redefine the list.
has_append_flag |= override_append.find("items") != override_append.end(); append |= override_append.find("items") != override_append.end();
if(has_append_flag) if(append)
{ {
collector.append(cfg, v); collector.append(cfg, v);
} }
@ -476,14 +476,14 @@ static void read_item(
rule_loader::macro_info v(ctx); rule_loader::macro_info v(ctx);
v.name = name; v.name = name;
bool has_append_flag = false; bool append = false;
decode_val(item, "condition", v.cond, ctx); decode_val(item, "condition", v.cond, ctx);
// Now set the proper context for the condition now that we know it exists // Now set the proper context for the condition now that we know it exists
v.cond_ctx = rule_loader::context(item["condition"], rule_loader::context::MACRO_CONDITION, "", ctx); v.cond_ctx = rule_loader::context(item["condition"], rule_loader::context::MACRO_CONDITION, "", ctx);
decode_optional_val(item, "append", has_append_flag, ctx); decode_optional_val(item, "append", append, ctx);
if(has_append_flag) if(append)
{ {
cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx); cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx);
} }
@ -493,13 +493,13 @@ static void read_item(
decode_overrides(item, overridable, overridable, override_append, override_replace, ctx); decode_overrides(item, overridable, overridable, override_append, override_replace, ctx);
bool has_overrides = !override_append.empty() || !override_replace.empty(); bool has_overrides = !override_append.empty() || !override_replace.empty();
THROW((has_append_flag && has_overrides), ERROR_OVERRIDE_APPEND, ctx); THROW((append && has_overrides), ERROR_OVERRIDE_APPEND, ctx);
// Since a macro only has a condition, if we have chosen to append to it we can append the entire object // Since a macro only has a condition, if we have chosen to append to it we can append the entire object
// otherwise we just want to redefine the macro. // otherwise we just want to redefine the macro.
has_append_flag |= override_append.find("condition") != override_append.end(); append |= override_append.find("condition") != override_append.end();
if(has_append_flag) if(append)
{ {
collector.append(cfg, v); collector.append(cfg, v);
} }