about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/args.hh
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/libutil/args.hh
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/libutil/args.hh')
-rw-r--r--third_party/nix/src/libutil/args.hh4
1 files changed, 3 insertions, 1 deletions
diff --git a/third_party/nix/src/libutil/args.hh b/third_party/nix/src/libutil/args.hh
index 20a6379fecba..2c352a04368c 100644
--- a/third_party/nix/src/libutil/args.hh
+++ b/third_party/nix/src/libutil/args.hh
@@ -4,6 +4,8 @@
 #include <map>
 #include <memory>
 
+#include <absl/strings/numbers.h>
+
 #include "util.hh"
 
 namespace nix {
@@ -179,7 +181,7 @@ class Args {
         .arity(1)
         .handler([=](std::vector<std::string> ss) {
           I n;
-          if (!string2Int(ss[0], n))
+          if (!absl::SimpleAtoi(ss[0], &n))
             throw UsageError("flag '--%s' requires a integer argument",
                              longName);
           fun(n);