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/libstore/build.cc | |
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/libstore/build.cc')
-rw-r--r-- | third_party/nix/src/libstore/build.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc index 49204a72a8cd..c0fa0074d6ea 100644 --- a/third_party/nix/src/libstore/build.cc +++ b/third_party/nix/src/libstore/build.cc @@ -13,6 +13,7 @@ #include <thread> #include <absl/strings/ascii.h> +#include <absl/strings/numbers.h> #include <fcntl.h> #include <grp.h> #include <netdb.h> @@ -2412,7 +2413,7 @@ void DerivationGoal::startBuilder() { userNamespaceSync.readSide = -1; pid_t tmp; - if (!string2Int<pid_t>(readLine(builderOut.readSide.get()), tmp)) { + if (!absl::SimpleAtoi(readLine(builderOut.readSide.get()), &tmp)) { abort(); } pid = tmp; @@ -2805,7 +2806,8 @@ void DerivationGoal::runChild() { std::string netrcData; try { if (drv->isBuiltin() && drv->builder == "builtin:fetchurl") { - netrcData = readFile(settings.netrcFile); + const std::string& netrc_file = settings.netrcFile; + netrcData = readFile(netrc_file); } } catch (SysError&) { } |