about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/profiles.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-24T21·29+0100
committerVincent Ambo <tazjin@google.com>2020-05-24T21·29+0100
commit838f86b0fd880b26539664140f04e5d16669dad8 (patch)
treec8fee2f0c136fbe5bb0735604e2f04d5b02698ba /third_party/nix/src/libstore/profiles.cc
parentf30b2e610d9e612504a9f6460e0cc83413b80aeb (diff)
style(3p/nix): Remove 'using std::*' from types.hh r/840
It is considered bad form to use things from includes in headers, as
these directives propagate to everywhere else and can make it
confusing.

types.hh (which is includes almost literally everywhere) had some of
these directives, which this commit removes.
Diffstat (limited to 'third_party/nix/src/libstore/profiles.cc')
-rw-r--r--third_party/nix/src/libstore/profiles.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/third_party/nix/src/libstore/profiles.cc b/third_party/nix/src/libstore/profiles.cc
index bdb90b7388..7c802d7549 100644
--- a/third_party/nix/src/libstore/profiles.cc
+++ b/third_party/nix/src/libstore/profiles.cc
@@ -19,17 +19,17 @@ static bool cmpGensByNumber(const Generation& a, const Generation& b) {
 
 /* Parse a generation name of the format
    `<profilename>-<number>-link'. */
-static int parseName(const string& profileName, const string& name) {
-  if (string(name, 0, profileName.size() + 1) != profileName + "-") {
+static int parseName(const std::string& profileName, const std::string& name) {
+  if (std::string(name, 0, profileName.size() + 1) != profileName + "-") {
     return -1;
   }
-  string s = string(name, profileName.size() + 1);
-  string::size_type p = s.find("-link");
-  if (p == string::npos) {
+  std::string s = std::string(name, profileName.size() + 1);
+  std::string::size_type p = s.find("-link");
+  if (p == std::string::npos) {
     return -1;
   }
   int n;
-  if (string2Int(string(s, 0, p), n) && n >= 0) {
+  if (string2Int(std::string(s, 0, p), n) && n >= 0) {
     return n;
   }
   return -1;
@@ -39,7 +39,7 @@ Generations findGenerations(const Path& profile, int& curGen) {
   Generations gens;
 
   Path profileDir = dirOf(profile);
-  string profileName = baseNameOf(profile);
+  std::string profileName = baseNameOf(profile);
 
   for (auto& i : readDirectory(profileDir)) {
     int n;
@@ -212,10 +212,10 @@ void deleteGenerationsOlderThan(const Path& profile, time_t t, bool dryRun) {
   }
 }
 
-void deleteGenerationsOlderThan(const Path& profile, const string& timeSpec,
-                                bool dryRun) {
+void deleteGenerationsOlderThan(const Path& profile,
+                                const std::string& timeSpec, bool dryRun) {
   time_t curTime = time(nullptr);
-  string strDays = string(timeSpec, 0, timeSpec.size() - 1);
+  std::string strDays = std::string(timeSpec, 0, timeSpec.size() - 1);
   int days;
 
   if (!string2Int(strDays, days) || days < 1) {
@@ -242,7 +242,7 @@ void lockProfile(PathLocks& lock, const Path& profile) {
   lock.setDeletion(true);
 }
 
-string optimisticLockProfile(const Path& profile) {
+std::string optimisticLockProfile(const Path& profile) {
   return pathExists(profile) ? readLink(profile) : "";
 }