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/store-api.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'third_party/nix/src/libstore/store-api.cc') diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc index 7658a51100..84b5841a82 100644 --- a/third_party/nix/src/libstore/store-api.cc +++ b/third_party/nix/src/libstore/store-api.cc @@ -251,7 +251,7 @@ bool Store::isValidPath(const Path& storePath) { auto res = state_->pathInfoCache.get(hashPart); if (res) { stats.narInfoReadAverted++; - return *res != 0; + return *res != nullptr; } } @@ -261,7 +261,8 @@ bool Store::isValidPath(const Path& storePath) { stats.narInfoReadAverted++; auto state_(state.lock()); state_->pathInfoCache.upsert( - hashPart, res.first == NarInfoDiskCache::oInvalid ? 0 : res.second); + hashPart, + res.first == NarInfoDiskCache::oInvalid ? nullptr : res.second); return res.first == NarInfoDiskCache::oValid; } } @@ -270,7 +271,7 @@ bool Store::isValidPath(const Path& storePath) { if (diskCache && !valid) { // FIXME: handle valid = true case. - diskCache->upsertNarInfo(getUri(), hashPart, 0); + diskCache->upsertNarInfo(getUri(), hashPart, nullptr); } return valid; @@ -329,7 +330,7 @@ void Store::queryPathInfo(const Path& storePath, auto state_(state.lock()); state_->pathInfoCache.upsert( hashPart, - res.first == NarInfoDiskCache::oInvalid ? 0 : res.second); + res.first == NarInfoDiskCache::oInvalid ? nullptr : res.second); if (res.first == NarInfoDiskCache::oInvalid || (res.second->path != storePath && storePathToName(storePath) != "")) { @@ -842,7 +843,7 @@ void Store::addToStore(const ValidPathInfo& info, const ref& nar, namespace nix { RegisterStoreImplementation::Implementations* - RegisterStoreImplementation::implementations = 0; + RegisterStoreImplementation::implementations = nullptr; /* Split URI into protocol+hierarchy part and its parameter set. */ std::pair splitUriAndParams( @@ -862,7 +863,7 @@ std::pair splitUriAndParams( throw Error("invalid URI parameter '%s'", value); } try { - decoded += std::stoul(std::string(value, i + 1, 2), 0, 16); + decoded += std::stoul(std::string(value, i + 1, 2), nullptr, 16); i += 3; } catch (...) { throw Error("invalid URI parameter '%s'", value); -- cgit 1.4.1