From d331d3a0b5c497a46e2636f308234be66566c04c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 20 May 2020 04:33:07 +0100 Subject: refactor(3p/nix): Apply clang-tidy's modernize-* fixes 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). --- third_party/nix/src/libstore/remote-store.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'third_party/nix/src/libstore/remote-store.cc') diff --git a/third_party/nix/src/libstore/remote-store.cc b/third_party/nix/src/libstore/remote-store.cc index e1fcb749a3..564ba444d2 100644 --- a/third_party/nix/src/libstore/remote-store.cc +++ b/third_party/nix/src/libstore/remote-store.cc @@ -1,8 +1,8 @@ #include "remote-store.hh" +#include #include -#include #include #include #include @@ -230,7 +230,7 @@ struct ConnectionHandle { RemoteStore::Connection* operator->() { return &*handle; } - void processStderr(Sink* sink = 0, Source* source = 0) { + void processStderr(Sink* sink = nullptr, Source* source = nullptr) { auto ex = handle->processStderr(sink, source); if (ex) { daemonException = true; @@ -324,7 +324,7 @@ void RemoteStore::querySubstitutablePathInfos(const PathSet& paths, } else { conn->to << wopQuerySubstitutablePathInfos << paths; conn.processStderr(); - size_t count = readNum(conn->from); + auto count = readNum(conn->from); for (size_t n = 0; n < count; n++) { Path path = readStorePath(*this, conn->from); SubstitutablePathInfo& info(infos[path]); @@ -388,7 +388,7 @@ void RemoteStore::queryReferrers(const Path& path, PathSet& referrers) { auto conn(getConnection()); conn->to << wopQueryReferrers << path; conn.processStderr(); - PathSet referrers2 = readStorePaths(*this, conn->from); + auto referrers2 = readStorePaths(*this, conn->from); referrers.insert(referrers2.begin(), referrers2.end()); } @@ -442,7 +442,7 @@ void RemoteStore::addToStore(const ValidPathInfo& info, Source& source, ; }); - conn.processStderr(0, source2.get()); + conn.processStderr(nullptr, source2.get()); auto importedPaths = readStorePaths(*this, conn->from); assert(importedPaths.size() <= 1); @@ -457,7 +457,7 @@ void RemoteStore::addToStore(const ValidPathInfo& info, Source& source, if (!tunnel) { copyNAR(source, conn->to); } - conn.processStderr(0, tunnel ? &source : nullptr); + conn.processStderr(nullptr, tunnel ? &source : nullptr); } } @@ -591,7 +591,7 @@ Roots RemoteStore::findRoots(bool censor) { auto conn(getConnection()); conn->to << wopFindRoots; conn.processStderr(); - size_t count = readNum(conn->from); + auto count = readNum(conn->from); Roots result; while (count--) { Path link = readString(conn->from); @@ -704,7 +704,7 @@ std::exception_ptr RemoteStore::Connection::processStderr(Sink* sink, if (!source) { throw Error("no source"); } - size_t len = readNum(from); + auto len = readNum(from); auto buf = std::make_unique(len); writeString(buf.get(), source->read(buf.get(), len), to); to.flush(); @@ -742,7 +742,7 @@ static RegisterStoreImplementation regStore( [](const std::string& uri, const Store::Params& params) -> std::shared_ptr { if (std::string(uri, 0, uriScheme.size()) != uriScheme) { - return 0; + return nullptr; } return std::make_shared( std::string(uri, uriScheme.size()), params); -- cgit 1.4.1