From e166206702c8dbd3162452cf26f368e856ac0138 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 11 Dec 2024 19:15:18 +0100 Subject: More clang-tidy fixes and increase warning level (and fix them) --- src/tools.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/tools.cc') diff --git a/src/tools.cc b/src/tools.cc index be94794..394a91c 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -175,10 +175,11 @@ std::string get_arch(ctor::output_system system) std::string arch; while(!feof(pipe)) { - char buf[1024]; - if(fgets(buf, sizeof(buf), pipe) != nullptr) + constexpr auto buffer_size{1024}; + std::array buf{}; + if(fgets(buf.data(), buf.size(), pipe) != nullptr) { - arch = buf; + arch = buf.data(); if(arch.starts_with("Target:")) { break; @@ -195,7 +196,8 @@ std::string get_arch(ctor::output_system system) } // Remove 'Target: ' prefix - arch = arch.substr(8); + constexpr auto prefix_length{8}; + arch = arch.substr(prefix_length); return arch; } -- cgit v1.2.3