about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/profiles.cc
diff options
context:
space:
mode:
authorKane York <kanepyork@gmail.com>2020-08-01T22·32-0700
committerkanepyork <rikingcoding@gmail.com>2020-08-01T22·45+0000
commit72fc2fd27e8ca9ddd6dad7f1c8f508e115aa2b60 (patch)
treeeacd58ae5e0de9ffaadc265b8fd417f2f62d0433 /third_party/nix/src/libstore/profiles.cc
parentcc3c45f739133162c840d500c0d633f46a524e06 (diff)
fix(3p/nix): revert "apply all clang-tidy fixes" r/1534
This reverts commit ef54f5da9fa30b5c302f2a49595ee5d041f9706a.

Resolved conflicts:
	third_party/nix/src/libexpr/eval.cc
	third_party/nix/src/libstore/builtins/fetchurl.cc
	third_party/nix/src/libstore/references.cc
	third_party/nix/src/libutil/hash.cc
	third_party/nix/src/nix-daemon/nix-daemon.cc

Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/nix/src/libstore/profiles.cc')
-rw-r--r--third_party/nix/src/libstore/profiles.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/third_party/nix/src/libstore/profiles.cc b/third_party/nix/src/libstore/profiles.cc
index c2a965e2edae..0d44c60cc4e9 100644
--- a/third_party/nix/src/libstore/profiles.cc
+++ b/third_party/nix/src/libstore/profiles.cc
@@ -30,7 +30,7 @@ static int parseName(absl::string_view profileName, absl::string_view name) {
     return -1;
   }
 
-  int n = 0;
+  int n;
   if (!absl::SimpleAtoi(name, &n) || n < 0) {
     return -1;
   }
@@ -45,12 +45,12 @@ Generations findGenerations(const Path& profile, int& curGen) {
   std::string profileName = baseNameOf(profile);
 
   for (auto& i : readDirectory(profileDir)) {
-    int n = 0;
+    int n;
     if ((n = parseName(profileName, i.name)) != -1) {
       Generation gen;
       gen.path = profileDir + "/" + i.name;
       gen.number = n;
-      struct stat st {};
+      struct stat st;
       if (lstat(gen.path.c_str(), &st) != 0) {
         throw SysError(format("statting '%1%'") % gen.path);
       }
@@ -75,10 +75,10 @@ Path createGeneration(const ref<LocalFSStore>& store, const Path& profile,
                       const Path& outPath) {
   /* The new generation number should be higher than old the
      previous ones. */
-  int dummy = 0;
+  int dummy;
   Generations gens = findGenerations(profile, dummy);
 
-  unsigned int num = 0;
+  unsigned int num;
   if (!gens.empty()) {
     Generation last = gens.back();
 
@@ -138,7 +138,7 @@ void deleteGenerations(const Path& profile,
   PathLocks lock;
   lockProfile(lock, profile);
 
-  int curGen = 0;
+  int curGen;
   Generations gens = findGenerations(profile, curGen);
 
   if (gensToDelete.find(curGen) != gensToDelete.end()) {
@@ -158,7 +158,7 @@ void deleteGenerationsGreaterThan(const Path& profile, int max, bool dryRun) {
   PathLocks lock;
   lockProfile(lock, profile);
 
-  int curGen = 0;
+  int curGen;
   bool fromCurGen = false;
   Generations gens = findGenerations(profile, curGen);
   for (auto i = gens.rbegin(); i != gens.rend(); ++i) {
@@ -181,7 +181,7 @@ void deleteOldGenerations(const Path& profile, bool dryRun) {
   PathLocks lock;
   lockProfile(lock, profile);
 
-  int curGen = 0;
+  int curGen;
   Generations gens = findGenerations(profile, curGen);
 
   for (auto& i : gens) {
@@ -195,7 +195,7 @@ void deleteGenerationsOlderThan(const Path& profile, time_t t, bool dryRun) {
   PathLocks lock;
   lockProfile(lock, profile);
 
-  int curGen = 0;
+  int curGen;
   Generations gens = findGenerations(profile, curGen);
 
   bool canDelete = false;
@@ -219,7 +219,7 @@ void deleteGenerationsOlderThan(const Path& profile,
                                 const std::string& timeSpec, bool dryRun) {
   time_t curTime = time(nullptr);
   std::string strDays = std::string(timeSpec, 0, timeSpec.size() - 1);
-  int days = 0;
+  int days;
 
   if (!absl::SimpleAtoi(strDays, &days) || days < 1) {
     throw Error(format("invalid number of days specifier '%1%'") % timeSpec);