From dc107950b4b6c075650f34c01f6f7896647b48aa Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Sat, 13 Jul 2024 03:08:29 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20gucc:=20use=20std=20ranges=20fro?= =?UTF-8?q?m=20C++23=20in=20fstab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gucc/src/fstab.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/gucc/src/fstab.cpp b/gucc/src/fstab.cpp index b4a60d4..823e8e0 100644 --- a/gucc/src/fstab.cpp +++ b/gucc/src/fstab.cpp @@ -4,31 +4,15 @@ #include // for tolower -#include // for transform -#include +#include // for transform +#include // for fs::path +#include // for ranges::transform #include #include #include -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wold-style-cast" -#elif defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuseless-cast" -#pragma GCC diagnostic ignored "-Wold-style-cast" -#endif - -#include - -#if defined(__clang__) -#pragma clang diagnostic pop -#elif defined(__GNUC__) -#pragma GCC diagnostic pop -#endif - namespace fs = std::filesystem; using namespace std::string_view_literals; @@ -68,7 +52,7 @@ constexpr auto get_mount_options(std::string_view mount_opts, std::string_view b constexpr auto string_tolower(std::string_view text) noexcept -> std::string { std::string res{text}; - ranges::transform(res, res.begin(), + std::ranges::transform(res, res.begin(), [](char char_elem) { return static_cast(std::tolower(static_cast(char_elem))); }); return res; } @@ -83,7 +67,7 @@ constexpr auto get_converted_fs(std::string_view fstype) noexcept -> std::string namespace gucc::fs { auto gen_fstab_entry(const Partition& partition) noexcept -> std::optional { - // Apperently some FS names named differently in /etc/fstab. + // Apparently some FS names named differently in /etc/fstab. const auto& fstype = get_converted_fs(partition.fstype); const auto& luks_mapper_name = partition.luks_mapper_name;