diff options
Diffstat (limited to 'src/tools.cc')
-rw-r--r-- | src/tools.cc | 10 |
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; } |