From a6a1a9769fabd967432fa50f3401fdfd9b3213c5 Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Thu, 11 Jan 2024 15:02:48 +0100 Subject: [PATCH] cleanup: restore the name of a variable Signed-off-by: Andrea Terzolo Co-authored-by: Luca Guerra --- userspace/engine/rule_loader_reader.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/userspace/engine/rule_loader_reader.cpp b/userspace/engine/rule_loader_reader.cpp index 57ab8455a52..abf23143707 100644 --- a/userspace/engine/rule_loader_reader.cpp +++ b/userspace/engine/rule_loader_reader.cpp @@ -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); } @@ -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); } @@ -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); } @@ -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); }