diff options
| author | Herman Semenoff <GermanAizek@yandex.ru> | 2026-04-08 11:37:24 +0300 |
|---|---|---|
| committer | Herman Semenoff <GermanAizek@yandex.ru> | 2026-04-08 11:37:24 +0300 |
| commit | af5b9453a1908021cf75c348522c1a12eeb0dee4 (patch) | |
| tree | e5d3d569e51d24207eb0228615f5eedd37e08296 /apt-pkg/aptconfiguration.cc | |
| parent | 04dcfd52355ca06143a8aaca4afd718a22fb0ded (diff) | |
apt: funcs called with a string literal consisting of a single character
Benchmark:
- https://stackoverflow.com/questions/62058906/why-my-performance-benchmark-gives-me-wrong-results
References:
- https://clang.llvm.org/extra/clang-tidy/checks/performance/prefer-single-char-overloads.html
Diffstat (limited to 'apt-pkg/aptconfiguration.cc')
| -rw-r--r-- | apt-pkg/aptconfiguration.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index a0164c6c3..fb6bcdb6d 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -175,8 +175,8 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, builtin.push_back("none"); for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) { string const name = SubstVar(Ent->d_name, "%5f", "_"); - size_t const foundDash = name.rfind("-"); - size_t const foundUnderscore = name.rfind("_", foundDash); + size_t const foundDash = name.rfind('-'); + size_t const foundUnderscore = name.rfind('_', foundDash); if (foundDash == string::npos || foundUnderscore == string::npos || foundDash <= foundUnderscore || name.substr(foundUnderscore+1, foundDash-(foundUnderscore+1)) != "Translation") @@ -692,7 +692,7 @@ std::string Configuration::color(std::string const &colorName, std::string const // | \\x1B<word> ; color escaped. // | <word> ; a simple color name // | <color> <color> ; a sequence of colors - if (color.find(" ") != color.npos) + if (color.find(' ') != color.npos) { std::string res; for (auto &&colorPart : VectorizeString(color, ' ')) |
