summaryrefslogtreecommitdiff
path: root/src/tools.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-12-11 19:15:18 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2024-12-11 21:48:37 +0100
commite166206702c8dbd3162452cf26f368e856ac0138 (patch)
treee4e659fc91b0a47f04755b6298b8085370aefc8d /src/tools.cc
parent936fb83eec4038a48e6e42f9f5d93677dc216ab4 (diff)
More clang-tidy fixes and increase warning level (and fix them)
Diffstat (limited to 'src/tools.cc')
-rw-r--r--src/tools.cc10
1 files changed, 6 insertions, 4 deletions
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<char, buffer_size> 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;
}