about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/build.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/libstore/build.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 'third_party/nix/src/libstore/build.cc')
-rw-r--r--third_party/nix/src/libstore/build.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc
index c0fa0074d6ea..a60f5ef173e6 100644
--- a/third_party/nix/src/libstore/build.cc
+++ b/third_party/nix/src/libstore/build.cc
@@ -10,10 +10,12 @@
 #include <queue>
 #include <regex>
 #include <sstream>
+#include <string>
 #include <thread>
 
 #include <absl/strings/ascii.h>
 #include <absl/strings/numbers.h>
+#include <absl/strings/str_split.h>
 #include <fcntl.h>
 #include <grp.h>
 #include <netdb.h>
@@ -1968,7 +1970,7 @@ void DerivationGoal::startBuilder() {
        by `nix-store --register-validity'.  However, the deriver
        fields are left empty. */
     std::string s = get(drv->env, "exportReferencesGraph");
-    auto ss = tokenizeString<Strings>(s);
+    std::vector<std::string> ss = absl::StrSplit(s, absl::ByAnyChar(" \t\n\r"));
     if (ss.size() % 2 != 0) {
       throw BuildError(
           format("odd number of tokens in 'exportReferencesGraph': '%1%'") % s);
@@ -2481,7 +2483,8 @@ void DerivationGoal::initTmpDir() {
      needed (attributes are not passed through the environment, so
      there is no size constraint). */
   if (!parsedDrv->getStructuredAttrs()) {
-    auto passAsFile = tokenizeString<StringSet>(get(drv->env, "passAsFile"));
+    std::set<std::string> passAsFile =
+        absl::StrSplit(get(drv->env, "passAsFile"), absl::ByAnyChar(" \t\n\r"));
     int fileNr = 0;
     for (auto& i : drv->env) {
       if (passAsFile.find(i.first) == passAsFile.end()) {