diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T03·33+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T03·33+0100 |
commit | d331d3a0b5c497a46e2636f308234be66566c04c (patch) | |
tree | 92526b2f99456c09c5cc81233ed5a4311abe3d2b /third_party/nix/src/libmain/shared.cc | |
parent | fed31b2c9b364fc1ed0b724c21b068cdedf46ee7 (diff) |
refactor(3p/nix): Apply clang-tidy's modernize-* fixes r/787
This applies the modernization fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html The 'modernize-use-trailing-return-type' fix was excluded due to my personal preference (more specifically, I think the 'auto' keyword is misleading in that position).
Diffstat (limited to 'third_party/nix/src/libmain/shared.cc')
-rw-r--r-- | third_party/nix/src/libmain/shared.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/third_party/nix/src/libmain/shared.cc b/third_party/nix/src/libmain/shared.cc index f63fe9c11c5a..8ff7cebbee4d 100644 --- a/third_party/nix/src/libmain/shared.cc +++ b/third_party/nix/src/libmain/shared.cc @@ -2,14 +2,15 @@ #include <algorithm> #include <cctype> +#include <csignal> #include <cstdlib> #include <exception> #include <iostream> #include <mutex> +#include <utility> #include <glog/logging.h> #include <openssl/crypto.h> -#include <signal.h> #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> @@ -128,13 +129,13 @@ void initNix() { sigemptyset(&act.sa_mask); act.sa_handler = SIG_DFL; act.sa_flags = 0; - if (sigaction(SIGCHLD, &act, 0)) { + if (sigaction(SIGCHLD, &act, nullptr)) { throw SysError("resetting SIGCHLD"); } /* Install a dummy SIGUSR1 handler for use with pthread_kill(). */ act.sa_handler = sigHandler; - if (sigaction(SIGUSR1, &act, 0)) { + if (sigaction(SIGUSR1, &act, nullptr)) { throw SysError("handling SIGUSR1"); } @@ -159,7 +160,7 @@ void initNix() { /* Initialise the PRNG. */ struct timeval tv; - gettimeofday(&tv, 0); + gettimeofday(&tv, nullptr); srandom(tv.tv_usec); /* On macOS, don't use the per-session TMPDIR (as set e.g. by @@ -175,7 +176,7 @@ LegacyArgs::LegacyArgs( const std::string& programName, std::function<bool(Strings::iterator& arg, const Strings::iterator& end)> parseArg) - : MixCommonArgs(programName), parseArg(parseArg) { + : MixCommonArgs(programName), parseArg(std::move(parseArg)) { mkFlag() .longName("no-build-output") .shortName('Q') @@ -395,6 +396,6 @@ PrintFreed::~PrintFreed() { } } -Exit::~Exit() {} +Exit::~Exit() = default; } // namespace nix |