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

@ -5,6 +5,7 @@
#include <absl/strings/match.h>
#include <absl/strings/numbers.h>
#include <absl/strings/str_split.h>
#include <glog/logging.h>
#include "crypto.hh"
@ -858,7 +859,8 @@ std::pair<std::string, Store::Params> splitUriAndParams(
Store::Params params;
auto q = uri.find('?');
if (q != std::string::npos) {
for (const auto& s : tokenizeString<Strings>(uri.substr(q + 1), "&")) {
Strings parts = absl::StrSplit(uri.substr(q + 1), absl::ByChar('&'));
for (const auto& s : parts) {
auto e = s.find('=');
if (e != std::string::npos) {
auto value = s.substr(e + 1);