From 4c23dccdcfa275176207f598ff24d3a88fa6b7ea Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Mon, 29 Jul 2024 00:42:58 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20gucc:=20refactor=20with=20clang-?= =?UTF-8?q?tidy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gucc/src/bootloader.cpp | 36 +++++++++++++++++------------------ gucc/src/package_profiles.cpp | 4 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gucc/src/bootloader.cpp b/gucc/src/bootloader.cpp index 5eddafb..d5ab788 100644 --- a/gucc/src/bootloader.cpp +++ b/gucc/src/bootloader.cpp @@ -22,30 +22,30 @@ using namespace std::string_view_literals; if (line.starts_with(needle)) { \ return fmt::format(needle "\"{}\"", f); \ } -#define CONV_OPT_F(needle, f, default_val) \ - if (line.starts_with(needle)) { \ - if (f) { \ - return fmt::format(needle "{}", *f); \ - } \ - return {"#" needle default_val}; \ +#define CONV_OPT_F(needle, f, default_val) \ + if (line.starts_with(needle)) { \ + if (f) { \ + return fmt::format(needle "{}", *(f)); \ + } \ + return {"#" needle default_val}; \ } -#define CONV_OPT_F_S(needle, f, default_val) \ - if (line.starts_with(needle)) { \ - if (f) { \ - return fmt::format(needle "\"{}\"", *f); \ - } \ - return {"#" needle "\"" default_val "\""}; \ +#define CONV_OPT_F_S(needle, f, default_val) \ + if (line.starts_with(needle)) { \ + if (f) { \ + return fmt::format(needle "\"{}\"", *(f)); \ + } \ + return {"#" needle "\"" default_val "\""}; \ } #define CONV_REQ_B(needle, f) \ if (line.starts_with(needle)) { \ return fmt::format(needle "{}", convert_boolean_val(needle, f)); \ } -#define CONV_OPT_B(needle, f, default_val) \ - if (line.starts_with(needle)) { \ - if (f) { \ - return fmt::format(needle "{}", convert_boolean_val(needle, *f)); \ - } \ - return {"#" needle default_val}; \ +#define CONV_OPT_B(needle, f, default_val) \ + if (line.starts_with(needle)) { \ + if (f) { \ + return fmt::format(needle "{}", convert_boolean_val(needle, *(f))); \ + } \ + return {"#" needle default_val}; \ } namespace { diff --git a/gucc/src/package_profiles.cpp b/gucc/src/package_profiles.cpp index 1dfb292..cd7cadb 100644 --- a/gucc/src/package_profiles.cpp +++ b/gucc/src/package_profiles.cpp @@ -44,7 +44,7 @@ auto parse_desktop_profiles(std::string_view config_content) noexcept -> std::op std::vector desktop_profiles{}; - auto desktop_table = netprof_table["desktop"].as_table(); + const auto* desktop_table = netprof_table["desktop"].as_table(); for (auto&& [key, value] : *desktop_table) { auto value_table = *value.as_table(); std::vector desktop_profile_packages{}; @@ -69,7 +69,7 @@ auto parse_net_profiles(std::string_view config_content) noexcept -> std::option parse_toml_array(netprof_table["base-packages"]["desktop"]["packages"].as_array(), net_profiles.base_profiles.base_desktop_packages); // parse desktop - auto desktop_table = netprof_table["desktop"].as_table(); + const auto* desktop_table = netprof_table["desktop"].as_table(); for (auto&& [key, value] : *desktop_table) { auto value_table = *value.as_table(); std::vector desktop_profile_packages{};