From 98299da0fda612b42ab933c47f18163cfef5fa71 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 25 May 2020 01:19:02 +0100 Subject: 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. --- third_party/nix/src/libexpr/attr-path.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'third_party/nix/src/libexpr/attr-path.cc') diff --git a/third_party/nix/src/libexpr/attr-path.cc b/third_party/nix/src/libexpr/attr-path.cc index 628b58c1b1e3..5f14fca21493 100644 --- a/third_party/nix/src/libexpr/attr-path.cc +++ b/third_party/nix/src/libexpr/attr-path.cc @@ -1,5 +1,7 @@ #include "attr-path.hh" +#include + #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; } -- cgit 1.4.1