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.
This commit is contained in:
parent
f30b2e610d
commit
838f86b0fd
85 changed files with 859 additions and 821 deletions
14
third_party/nix/src/nix-build/nix-build.cc
vendored
14
third_party/nix/src/nix-build/nix-build.cc
vendored
|
|
@ -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<string> shellwords(const string& s) {
|
||||
std::vector<std::string> shellwords(const std::string& s) {
|
||||
std::regex whitespace("^(\\s+).*");
|
||||
auto begin = s.cbegin();
|
||||
std::vector<string> res;
|
||||
std::vector<std::string> 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<string> savedArgs;
|
||||
std::vector<std::string> savedArgs;
|
||||
|
||||
AutoDelete tmpDir(createTempDir("", myName));
|
||||
|
||||
std::string outLink = "./result";
|
||||
|
||||
// List of environment variables kept for --pure
|
||||
std::set<string> keepVars{
|
||||
std::set<std::string> 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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue