about summary refs log tree commit diff
path: root/third_party/nix/src/nix/upgrade-nix.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T14·54+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T14·54+0100
commitbf452cbc2ae2b209ec262ce858deca470d086f24 (patch)
tree198e98902be569301ecb9a821b0c9512b128f930 /third_party/nix/src/nix/upgrade-nix.cc
parentb99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (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 '')
-rw-r--r--third_party/nix/src/nix/upgrade-nix.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/nix/src/nix/upgrade-nix.cc b/third_party/nix/src/nix/upgrade-nix.cc
index 7098e0eb90..174cc1f1fc 100644
--- a/third_party/nix/src/nix/upgrade-nix.cc
+++ b/third_party/nix/src/nix/upgrade-nix.cc
@@ -1,4 +1,6 @@
 #include <absl/strings/match.h>
+#include <absl/strings/str_cat.h>
+#include <absl/strings/str_split.h>
 #include <glog/logging.h>
 
 #include "attr-path.hh"
@@ -101,8 +103,8 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand {
   static Path getProfileDir(const ref<Store>& store) {
     Path where;
 
-    for (auto& dir : tokenizeString<Strings>(getEnv("PATH"), ":")) {
-      if (pathExists(dir + "/nix-env")) {
+    for (auto& dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) {
+      if (pathExists(absl::StrCat(dir, "/nix-env"))) {
         where = dir;
         break;
       }