summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
authorHerman Semenoff <GermanAizek@yandex.ru>2026-04-08 11:37:24 +0300
committerHerman Semenoff <GermanAizek@yandex.ru>2026-04-08 11:37:24 +0300
commitaf5b9453a1908021cf75c348522c1a12eeb0dee4 (patch)
treee5d3d569e51d24207eb0228615f5eedd37e08296 /apt-private
parent04dcfd52355ca06143a8aaca4afd718a22fb0ded (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-private')
-rw-r--r--apt-private/private-install.cc4
-rw-r--r--apt-private/private-source.cc12
2 files changed, 8 insertions, 8 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index c619aa45a..33c529712 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -1114,8 +1114,8 @@ static bool AddIfVolatile(pkgSourceList *const SL, std::vector<PseudoPkg> &Volat
}
else
{
- auto const found = pkg.name.rfind("/");
- if (found == pkg.name.find("/"))
+ auto const found = pkg.name.rfind('/');
+ if (found == pkg.name.find('/'))
_error->Error(_("Unsupported file %s given on commandline"), I);
else
{
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index ebd3a980c..eb7eee931 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -86,21 +86,21 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
TmpSrc = TmpSrc.substr(4);
}
// extract release
- size_t found = TmpSrc.find_last_of("/");
+ size_t found = TmpSrc.find_last_of('/');
if (found != std::string::npos)
{
RelTag = TmpSrc.substr(found+1);
TmpSrc = TmpSrc.substr(0,found);
}
// extract the version
- found = TmpSrc.find_last_of("=");
+ found = TmpSrc.find_last_of('=');
if (found != std::string::npos)
{
VerTag = UserRequestedVerTag = TmpSrc.substr(found+1);
TmpSrc = TmpSrc.substr(0,found);
}
// extract arch
- found = TmpSrc.find_last_of(":");
+ found = TmpSrc.find_last_of(':');
if (found != std::string::npos)
{
ArchTag = TmpSrc.substr(found+1);
@@ -359,14 +359,14 @@ bool DoSource(CommandLine &CmdL)
while (pos != std::string::npos)
{
pos += strlen("\nVcs-");
- std::string vcs = srec.substr(pos,srec.find(":",pos)-pos);
+ std::string vcs = srec.substr(pos,srec.find(':',pos)-pos);
if(vcs == "Browser")
{
pos = srec.find("\nVcs-", pos);
continue;
}
pos += vcs.length()+2;
- std::string::size_type epos = srec.find("\n", pos);
+ std::string::size_type epos = srec.find('\n', pos);
std::string const uri = srec.substr(pos,epos-pos);
ioprintf(c1out, _("NOTICE: '%s' packaging is maintained in "
"the '%s' version control system at:\n"
@@ -806,7 +806,7 @@ bool DoBuildDep(CommandLine &CmdL)
WriteBuildDependencyPackage(buildDepsPkgFile, pseudo, pseudoArch,
GetBuildDeps(Last, Src.c_str(), hostArch));
std::string reltag = *I;
- size_t found = reltag.find_last_of("/");
+ size_t found = reltag.find_last_of('/');
if (found == std::string::npos)
reltag.clear();
else