From af5b9453a1908021cf75c348522c1a12eeb0dee4 Mon Sep 17 00:00:00 2001 From: Herman Semenoff Date: Wed, 8 Apr 2026 11:37:24 +0300 Subject: 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 --- apt-pkg/deb/debmetaindex.cc | 2 +- apt-pkg/deb/dpkgpm.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index b85163654..8fcb83678 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1318,7 +1318,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ /// allows you to match a.b.c against itself, .b.c, and .c, but not b.c static inline std::string NextLevelDomain(std::string Host) { - auto nextDot = Host.find(".", 1); + auto nextDot = Host.find('.', 1); if (nextDot == Host.npos) return ""; return Host.substr(nextDot); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 0f2467607..395227f50 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -646,7 +646,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) } // At this point we have a pkgname, but it might not be arch-qualified ! - if (pkgname.find(":") == std::string::npos) + if (pkgname.find(':') == std::string::npos) { pkgCache::GrpIterator const Grp = Cache.FindGrp(pkgname); if (unlikely(Grp.end()== true)) @@ -779,7 +779,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) } std::string arch = ""; - if (pkgname.find(":") != string::npos) + if (pkgname.find(':') != string::npos) arch = StringSplit(pkgname, ":")[1]; std::string i18n_pkgname = pkgname; if (arch.size() != 0) -- cgit v1.2.3-70-g09d2