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-25T00·19+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T00·19+0100
commit98299da0fda612b42ab933c47f18163cfef5fa71 (patch)
tree78fc0f1127b5f2336d3e370f342f72f38d5a5ee2 /third_party/nix/src/libexpr/names.cc
parentb371821db59d33851d521d66ba1fb126d388c00f (diff)
refactor(3p/nix/libutil): Replace string2Int & trim functions r/843
Replaces these functions with corresponding functions from Abseil,
namely absl::StripAsciiWhitespace and absl::SimpleAtoi.

In the course of doing this some minor things I encountered along the
way were also refactored.

This also changes the signatures of the various custom readFile
functions to use absl::string_view types.
Diffstat (limited to 'third_party/nix/src/libexpr/names.cc')
-rw-r--r--third_party/nix/src/libexpr/names.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/nix/src/libexpr/names.cc b/third_party/nix/src/libexpr/names.cc
index 20c326776c..769f9e99db 100644
--- a/third_party/nix/src/libexpr/names.cc
+++ b/third_party/nix/src/libexpr/names.cc
@@ -2,6 +2,8 @@
 
 #include <memory>
 
+#include <absl/strings/numbers.h>
+
 #include "util.hh"
 
 namespace nix {
@@ -68,8 +70,8 @@ std::string nextComponent(std::string::const_iterator& p,
 static bool componentsLT(const std::string& c1, const std::string& c2) {
   int n1;
   int n2;
-  bool c1Num = string2Int(c1, n1);
-  bool c2Num = string2Int(c2, n2);
+  bool c1Num = absl::SimpleAtoi(c1, &n1);
+  bool c2Num = absl::SimpleAtoi(c2, &n2);
 
   if (c1Num && c2Num) {
     return n1 < n2;