diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T14·54+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T14·54+0100 |
commit | bf452cbc2ae2b209ec262ce858deca470d086f24 (patch) | |
tree | 198e98902be569301ecb9a821b0c9512b128f930 /third_party/nix/src/libstore/ssh.cc | |
parent | b99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (diff) |
refactor(3p/nix): Replace tokenizeStrings with absl::StrSplit r/846
This function was a custom (and inefficient in the case of single-character delimiters) string splitter which was used all over the codebase. Abseil provides an appropriate replacement function.
Diffstat (limited to 'third_party/nix/src/libstore/ssh.cc')
-rw-r--r-- | third_party/nix/src/libstore/ssh.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/ssh.cc b/third_party/nix/src/libstore/ssh.cc index 76c78b2fcd77..1b09eb42c6b9 100644 --- a/third_party/nix/src/libstore/ssh.cc +++ b/third_party/nix/src/libstore/ssh.cc @@ -3,6 +3,7 @@ #include <utility> #include <absl/strings/match.h> +#include <absl/strings/str_split.h> namespace nix { @@ -20,8 +21,9 @@ SSHMaster::SSHMaster(const std::string& host, std::string keyFile, } void SSHMaster::addCommonSSHOpts(Strings& args) { - for (auto& i : tokenizeString<Strings>(getEnv("NIX_SSHOPTS"))) { - args.push_back(i); + for (auto& i : + absl::StrSplit(getEnv("NIX_SSHOPTS"), absl::ByAnyChar(" \t\n\r"))) { + args.push_back(std::string(i)); } if (!keyFile.empty()) { args.insert(args.end(), {"-i", keyFile}); |