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/libexpr/attr-path.cc
vendored
4
third_party/nix/src/libexpr/attr-path.cc
vendored
|
|
@ -1,5 +1,7 @@
|
|||
#include "attr-path.hh"
|
||||
|
||||
#include <absl/strings/numbers.h>
|
||||
|
||||
#include "eval-inline.hh"
|
||||
#include "util.hh"
|
||||
|
||||
|
|
@ -50,7 +52,7 @@ Value* findAlongAttrPath(EvalState& state, const std::string& attrPath,
|
|||
/* Is i an index (integer) or a normal attribute name? */
|
||||
enum { apAttr, apIndex } apType = apAttr;
|
||||
unsigned int attrIndex;
|
||||
if (string2Int(attr, attrIndex)) {
|
||||
if (absl::SimpleAtoi(attr, &attrIndex)) {
|
||||
apType = apIndex;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue