refactor(3p/nix/libutil): Replace string2Int & trim functions
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.
This commit is contained in:
parent
b371821db5
commit
98299da0fd
19 changed files with 84 additions and 72 deletions
4
third_party/nix/src/libutil/args.hh
vendored
4
third_party/nix/src/libutil/args.hh
vendored
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue