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/binary-cache-store.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/binary-cache-store.cc')
-rw-r--r-- | third_party/nix/src/libstore/binary-cache-store.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/third_party/nix/src/libstore/binary-cache-store.cc b/third_party/nix/src/libstore/binary-cache-store.cc index ea36078435ba..f631c9dee231 100644 --- a/third_party/nix/src/libstore/binary-cache-store.cc +++ b/third_party/nix/src/libstore/binary-cache-store.cc @@ -6,6 +6,7 @@ #include <absl/strings/ascii.h> #include <absl/strings/numbers.h> +#include <absl/strings/str_split.h> #include "archive.hh" #include "compression.hh" @@ -41,7 +42,7 @@ void BinaryCacheStore::init() { upsertFile(cacheInfoFile, "StoreDir: " + storeDir + "\n", "text/x-nix-cache-info"); } else { - for (auto& line : tokenizeString<Strings>(*cacheInfo, "\n")) { + for (auto& line : absl::StrSplit(*cacheInfo, absl::ByChar('\n'))) { size_t colon = line.find(':'); if (colon == std::string::npos) { continue; |