Skip to content

Commit

Permalink
cleanup: restore the name of a variable
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Luca Guerra <luca.guerra@sysdig.com>
  • Loading branch information
2 people authored and poiana committed Jan 11, 2024
1 parent e601ec2 commit a6a1a97
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions userspace/engine/rule_loader_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ static void read_item(
rule_loader::context ctx(item, rule_loader::context::LIST, name, parent);
rule_loader::list_info v(ctx);

bool has_append_flag = false;
bool append = false;
decode_val(item, "list", v.name, ctx);
decode_items(item, v.items, ctx);

decode_optional_val(item, "append", has_append_flag, ctx);
if(has_append_flag)
decode_optional_val(item, "append", append, ctx);
if(append)
{
cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx);
}
Expand All @@ -450,13 +450,13 @@ static void read_item(
decode_overrides(item, overridable, overridable, override_append, override_replace, ctx);
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
// 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);
}
Expand All @@ -476,14 +476,14 @@ static void read_item(
rule_loader::macro_info v(ctx);
v.name = name;

bool has_append_flag = false;
bool append = false;
decode_val(item, "condition", v.cond, ctx);

// 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);

decode_optional_val(item, "append", has_append_flag, ctx);
if(has_append_flag)
decode_optional_val(item, "append", append, ctx);
if(append)
{
cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx);
}
Expand All @@ -493,13 +493,13 @@ static void read_item(
decode_overrides(item, overridable, overridable, override_append, override_replace, ctx);
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
// 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);
}
Expand Down

0 comments on commit a6a1a97

Please sign in to comment.