diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T00·19+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T00·19+0100 |
commit | 98299da0fda612b42ab933c47f18163cfef5fa71 (patch) | |
tree | 78fc0f1127b5f2336d3e370f342f72f38d5a5ee2 /third_party/nix/src/libmain | |
parent | b371821db59d33851d521d66ba1fb126d388c00f (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/libmain')
-rw-r--r-- | third_party/nix/src/libmain/shared.hh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/third_party/nix/src/libmain/shared.hh b/third_party/nix/src/libmain/shared.hh index edd0a5159a9d..60d7918931d7 100644 --- a/third_party/nix/src/libmain/shared.hh +++ b/third_party/nix/src/libmain/shared.hh @@ -2,6 +2,7 @@ #include <locale> +#include <absl/strings/numbers.h> #include <signal.h> #include "args.hh" @@ -78,7 +79,7 @@ N getIntArg(const std::string& opt, Strings::iterator& i, } } N n; - if (!string2Int(s, n)) + if (!absl::SimpleAtoi(s, &n)) throw UsageError(format("'%1%' requires an integer argument") % opt); return n * multiplier; } |