about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/names.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-21T04·43+0100
committerVincent Ambo <tazjin@google.com>2020-05-21T04·43+0100
commita162f4e8258ce1d401bc1cdb018e1212db80772d (patch)
treecf78df573c740ec054aea483101be29e5fa06e8c /third_party/nix/src/libexpr/names.cc
parentb97307056da53f094ab46e12f87d6a3f0a2be79f (diff)
refactor(3p/nix/libexpr): Use std::string as qualified type r/797
Replaces most uses of `string` with `std::string`.

This came up because I removed the "types.hh" import from
"symbol-table.hh", which percolated through a bunch of files where
`string` was suddenly no longer defined ... *sigh*
Diffstat (limited to 'third_party/nix/src/libexpr/names.cc')
-rw-r--r--third_party/nix/src/libexpr/names.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/third_party/nix/src/libexpr/names.cc b/third_party/nix/src/libexpr/names.cc
index f559c13a6115..ac8150532f25 100644
--- a/third_party/nix/src/libexpr/names.cc
+++ b/third_party/nix/src/libexpr/names.cc
@@ -13,7 +13,7 @@ DrvName::DrvName() { name = ""; }
    a letter.  The `version' part is the rest (excluding the separating
    dash).  E.g., `apache-httpd-2.0.48' is parsed to (`apache-httpd',
    '2.0.48'). */
-DrvName::DrvName(const string& s) : hits(0) {
+DrvName::DrvName(const std::string& s) : hits(0) {
   name = fullName = s;
   for (unsigned int i = 0; i < s.size(); ++i) {
     /* !!! isalpha/isdigit are affected by the locale. */
@@ -51,7 +51,7 @@ string nextComponent(string::const_iterator& p,
   /* If the first character is a digit, consume the longest sequence
      of digits.  Otherwise, consume the longest sequence of
      non-digit, non-separator characters. */
-  string s;
+  std::string s;
   if (isdigit(*p) != 0) {
     while (p != end && (isdigit(*p) != 0)) {
       s += *p++;
@@ -65,7 +65,7 @@ string nextComponent(string::const_iterator& p,
   return s;
 }
 
-static bool componentsLT(const string& c1, const string& c2) {
+static bool componentsLT(const std::string& c1, const std::string& c2) {
   int n1;
   int n2;
   bool c1Num = string2Int(c1, n1);
@@ -90,13 +90,13 @@ static bool componentsLT(const string& c1, const string& c2) {
   }
 }
 
-int compareVersions(const string& v1, const string& v2) {
+int compareVersions(const std::string& v1, const std::string& v2) {
   string::const_iterator p1 = v1.begin();
   string::const_iterator p2 = v2.begin();
 
   while (p1 != v1.end() || p2 != v2.end()) {
-    string c1 = nextComponent(p1, v1.end());
-    string c2 = nextComponent(p2, v2.end());
+    std::string c1 = nextComponent(p1, v1.end());
+    std::string c2 = nextComponent(p2, v2.end());
     if (componentsLT(c1, c2)) {
       return -1;
     }