refactor(3p/nix): Replace tokenizeStrings with absl::StrSplit

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.
This commit is contained in:
Vincent Ambo 2020-05-25 15:54:14 +01:00
parent b99b368d17
commit bf452cbc2a
29 changed files with 146 additions and 145 deletions

View file

@ -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;