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
3
third_party/nix/src/libmain/shared.hh
vendored
3
third_party/nix/src/libmain/shared.hh
vendored
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue