From 838f86b0fd880b26539664140f04e5d16669dad8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 24 May 2020 22:29:21 +0100 Subject: style(3p/nix): Remove 'using std::*' from types.hh It is considered bad form to use things from includes in headers, as these directives propagate to everywhere else and can make it confusing. types.hh (which is includes almost literally everywhere) had some of these directives, which this commit removes. --- third_party/nix/src/nix-build/nix-build.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'third_party/nix/src/nix-build/nix-build.cc') diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc index a98603f351..6906a80583 100644 --- a/third_party/nix/src/nix-build/nix-build.cc +++ b/third_party/nix/src/nix-build/nix-build.cc @@ -27,10 +27,10 @@ using namespace std::string_literals; /* Recreate the effect of the perl shellwords function, breaking up a * string into arguments like a shell word, including escapes */ -std::vector shellwords(const string& s) { +std::vector shellwords(const std::string& s) { std::regex whitespace("^(\\s+).*"); auto begin = s.cbegin(); - std::vector res; + std::vector res; std::string cur; enum state { sBegin, sQuote }; state st = sBegin; @@ -90,14 +90,14 @@ static void _main(int argc, char** argv) { auto inShebang = false; std::string script; - std::vector savedArgs; + std::vector savedArgs; AutoDelete tmpDir(createTempDir("", myName)); std::string outLink = "./result"; // List of environment variables kept for --pure - std::set keepVars{ + std::set keepVars{ "HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL", "TZ", "PAGER", "NIX_BUILD_SHELL", "SHLVL"}; @@ -405,7 +405,7 @@ static void _main(int argc, char** argv) { // Build or fetch all dependencies of the derivation. for (const auto& input : drv.inputDrvs) { if (std::all_of(envExclude.cbegin(), envExclude.cend(), - [&](const string& exclude) { + [&](const std::string& exclude) { return !std::regex_search(input.first, std::regex(exclude)); })) { @@ -452,7 +452,7 @@ static void _main(int argc, char** argv) { for (auto& var : drv.env) { if (passAsFile.count(var.first) != 0u) { keepTmp = true; - string fn = ".attr-" + std::to_string(fileNr++); + std::string fn = ".attr-" + std::to_string(fileNr++); Path p = (Path)tmpDir + "/" + fn; writeFile(p, var.second); env[var.first + "Path"] = p; @@ -489,7 +489,7 @@ static void _main(int argc, char** argv) { (Path)tmpDir, (pure ? "" : "p=$PATH; "), (pure ? "" : "PATH=$PATH:$p; unset p; "), dirOf(shell), shell, (getenv("TZ") != nullptr - ? (string("export TZ='") + getenv("TZ") + "'; ") + ? (std::string("export TZ='") + getenv("TZ") + "'; ") : ""), envCommand)); -- cgit 1.4.1