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/libstore/store-api.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/libstore/store-api.cc')
-rw-r--r-- | third_party/nix/src/libstore/store-api.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc index 7658a5110092..84b5841a82e6 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<std::string>& nar, namespace nix { RegisterStoreImplementation::Implementations* - RegisterStoreImplementation::implementations = 0; + RegisterStoreImplementation::implementations = nullptr; /* Split URI into protocol+hierarchy part and its parameter set. */ std::pair<std::string, Store::Params> splitUriAndParams( @@ -862,7 +863,7 @@ std::pair<std::string, Store::Params> 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); |