diff options
| author | Julian Andres Klode <jak@debian.org> | 2025-07-28 12:06:00 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2025-10-25 18:42:14 +0000 |
| commit | 50d8703c785898d06463513896e37cbe7cedd471 (patch) | |
| tree | e43b858bb0a0efe70ef1428325eaa2b414ec3e39 /apt-pkg/init.cc | |
| parent | a92a5ecc465055027d9fbb899f359ec7eab110bd (diff) | |
Move split() to APT::String::Split()
This splits based upon contiguous whitespace as separators
Diffstat (limited to 'apt-pkg/init.cc')
| -rw-r--r-- | apt-pkg/init.cc | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 61d45e37e..531cd258d 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -38,19 +38,6 @@ namespace APT { APT_HIDDEN extern std::unordered_map<std::string, std::vector<std::string>> ArchToTupleMap; } -// Splits by whitespace. There may be continuous spans of whitespace - they -// will be considered as one. -static std::vector<std::string> split(std::string const & s) -{ - std::vector<std::string> vec; - std::istringstream iss(s); - iss.imbue(std::locale::classic()); - for(std::string current_s; iss >> current_s; ) - vec.push_back(current_s); - return vec; -} - - // pkgInitArchTupleMap - Initialize the architecture tuple map /*{{{*/ // --------------------------------------------------------------------- /* This initializes */ @@ -67,7 +54,7 @@ static bool pkgInitArchTupleMap() { if (cpuline[0] == '#' || cpuline[0] == '\0') continue; - auto cpurow = split(cpuline); + auto cpurow = APT::String::Split(cpuline); auto cpu = APT::String::Strip(cpurow.at(0)); cpus.emplace_back(cpu); @@ -90,7 +77,7 @@ static bool pkgInitArchTupleMap() if (tupleline[0] == '#' || tupleline[0] == '\0') continue; - std::vector<std::string> tuplerow = split(tupleline); + std::vector<std::string> tuplerow = APT::String::Split(tupleline); auto tuple = APT::String::Strip(tuplerow.at(0)); auto arch = APT::String::Strip(tuplerow.at(1)); |
