diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-19T16·38+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-19T16·38+0100 |
commit | b490742a511dd03afc43f5143d6d61edaeeb8091 (patch) | |
tree | 727370e8e7607a3078c2ce1cd6d717105c7d9c44 /third_party/nix/src/nix-daemon/nix-daemon.cc | |
parent | c758de9d22506eb279c5abe61f621e5c8f61af95 (diff) |
style(3p/nix): Enforce braces around loops and conditionals r/767
This change was generated with: fd -e cc -e hh | xargs -I{} clang-tidy {} -p ~/projects/nix-build/ \ --checks='-*,readability-braces-around-statements' --fix \ -fix-errors Some manual fixes were applied because some convoluted unbraced statements couldn't be untangled by clang-tidy. This commit still includes invalid files, but I decided to clean them up in a subsequent commit so that it becomes more obvious where clang-tidy failed. Maybe this will allow for a bug-report to clang-tidy.
Diffstat (limited to 'third_party/nix/src/nix-daemon/nix-daemon.cc')
-rw-r--r-- | third_party/nix/src/nix-daemon/nix-daemon.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/third_party/nix/src/nix-daemon/nix-daemon.cc b/third_party/nix/src/nix-daemon/nix-daemon.cc index 7d9c0a734aeb..dbc49edfade5 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon.cc @@ -117,9 +117,9 @@ struct TunnelLogger { state->canSendStderr = false; - if (success) + if (success) { to << STDERR_LAST; - else { + } else { to << STDERR_ERROR << msg; if (status != 0) to << status; } @@ -304,8 +304,10 @@ static void performOp(TunnelLogger* logger, ref<Store> store, bool trusted, addToStoreFromDump(). */ ParseSink sink; /* null sink; just parse the NAR */ parseDump(sink, savedNAR); - } else - parseDump(savedRegular, from); + } else { + parseDump + } + (savedRegular, from); logger->startWork(); if (!savedRegular.regular) throw Error("regular file expected"); @@ -575,7 +577,9 @@ static void performOp(TunnelLogger* logger, ref<Store> store, bool trusted, try { info = store->queryPathInfo(path); } catch (InvalidPath&) { - if (GET_PROTOCOL_MINOR(clientVersion) < 17) throw; + if (GET_PROTOCOL_MINOR(clientVersion) < 17) { + throw; + } } logger->stopWork(); if (info) { @@ -641,14 +645,18 @@ static void performOp(TunnelLogger* logger, ref<Store> store, bool trusted, from >> info.registrationTime >> info.narSize >> info.ultimate; info.sigs = readStrings<StringSet>(from); from >> info.ca >> repair >> dontCheckSigs; - if (!trusted && dontCheckSigs) dontCheckSigs = false; - if (!trusted) info.ultimate = false; + if (!trusted && dontCheckSigs) { + dontCheckSigs = false; + } + if (!trusted) { + info.ultimate = false; + } std::string saved; std::unique_ptr<Source> source; - if (GET_PROTOCOL_MINOR(clientVersion) >= 21) + if (GET_PROTOCOL_MINOR(clientVersion) >= 21) { source = std::make_unique<TunnelSource>(from); - else { + } else { TeeSink tee(from); parseDump(tee, tee.source); saved = std::move(*tee.source.data); @@ -758,7 +766,9 @@ static void processConnection(bool trusted, const std::string& userName, happens, just send the error message and exit. */ bool errorAllowed = tunnelLogger->state_.lock()->canSendStderr; tunnelLogger->stopWork(false, e.msg(), e.status); - if (!errorAllowed) throw; + if (!errorAllowed) { + throw; + } } catch (std::bad_alloc& e) { tunnelLogger->stopWork(false, "Nix daemon out of memory", 1); throw; |