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/store-api.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/store-api.cc')
-rw-r--r-- | third_party/nix/src/libstore/store-api.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc index 9440d78d5f12..afdbc14e29a3 100644 --- a/third_party/nix/src/libstore/store-api.cc +++ b/third_party/nix/src/libstore/store-api.cc @@ -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); |