From c50b7554cfd23b53107f2a2917a0be22a68b0c11 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 7 Jan 2025 07:26:39 +0100 Subject: Move readDeps function to its own file. --- src/util.cc | 60 ------------------------------------------------------------ 1 file changed, 60 deletions(-) (limited to 'src/util.cc') diff --git a/src/util.cc b/src/util.cc index 73b158d..dbd4c3c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -28,66 +28,6 @@ std::string readFile(const std::string& fileName) return {bytes.data(), static_cast(fileSize)}; } -std::vector readDeps(const std::string& depFile) -{ - if(!std::filesystem::exists(depFile)) - { - return {}; - } - - auto str = readFile(depFile); - - std::vector output; - std::string tmp; - bool start{false}; - bool in_whitespace{false}; - for(const auto& c : str) - { - if(c == '\\' || c == '\n') - { - continue; - } - - if(c == ':') - { - start = true; - continue; - } - - if(!start) - { - continue; - } - - if(c == ' ' || c == '\t') - { - if(in_whitespace) - { - continue; - } - - if(!tmp.empty()) - { - output.push_back(tmp); - } - tmp.clear(); - in_whitespace = true; - } - else - { - in_whitespace = false; - tmp += c; - } - } - - if(!tmp.empty()) - { - output.push_back(tmp); - } - - return output; -} - ctor::language languageFromExtension(const std::filesystem::path& file) { auto ext = file.extension().string(); -- cgit v1.2.3