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/nix/edit.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/nix/edit.cc')
-rw-r--r-- | third_party/nix/src/nix/edit.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/third_party/nix/src/nix/edit.cc b/third_party/nix/src/nix/edit.cc index 330a845dc520..4d5cb382bc48 100644 --- a/third_party/nix/src/nix/edit.cc +++ b/third_party/nix/src/nix/edit.cc @@ -1,3 +1,4 @@ +#include <absl/strings/str_split.h> #include <glog/logging.h> #include <unistd.h> @@ -54,7 +55,7 @@ struct CmdEdit : InstallableCommand { auto editor = getEnv("EDITOR", "cat"); - auto args = tokenizeString<Strings>(editor); + Strings args = absl::StrSplit(editor, absl::ByAnyChar(" \t\n\r")); if (editor.find("emacs") != std::string::npos || editor.find("nano") != std::string::npos || |