summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefile.cc
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2025-01-23 20:50:39 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-14 19:45:12 +0100
commit729a5c8f4fb8c841497d26170e1a47c41617ecd9 (patch)
tree3d9e97b68a2a9706ce7295e0b056a053449b39cc /apt-pkg/cachefile.cc
parent384cfa1fe9dfd30b35d6f8b0ae87be643ab75d06 (diff)
string{=> _view} flNotDir(string{=> _view}). Configuration::{Cnd,}Set(Value: string{=> _view})
Diffstat (limited to 'apt-pkg/cachefile.cc')
-rw-r--r--apt-pkg/cachefile.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index e27688b4e..8034ffea8 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -318,15 +318,15 @@ void pkgCacheFile::RemoveCaches()
if (pkgcache.empty() == false)
{
std::string cachedir = flNotFile(pkgcache);
- std::string cachefile = flNotDir(pkgcache);
+ std::string cachefile{flNotDir(pkgcache)};
if (cachedir.empty() != true && cachefile.empty() != true && DirectoryExists(cachedir) == true)
{
cachefile.append(".");
std::vector<std::string> caches = GetListOfFilesInDir(cachedir, false);
for (std::vector<std::string>::const_iterator file = caches.begin(); file != caches.end(); ++file)
{
- std::string nuke = flNotDir(*file);
- if (strncmp(cachefile.c_str(), nuke.c_str(), cachefile.length()) != 0)
+ auto nuke = flNotDir(*file);
+ if (cachefile != nuke.substr(0, cachefile.length()))
continue;
RemoveFile("RemoveCaches", *file);
}
@@ -337,15 +337,15 @@ void pkgCacheFile::RemoveCaches()
return;
std::string cachedir = flNotFile(srcpkgcache);
- std::string cachefile = flNotDir(srcpkgcache);
+ std::string cachefile{flNotDir(srcpkgcache)};
if (cachedir.empty() == true || cachefile.empty() == true || DirectoryExists(cachedir) == false)
return;
cachefile.append(".");
std::vector<std::string> caches = GetListOfFilesInDir(cachedir, false);
for (std::vector<std::string>::const_iterator file = caches.begin(); file != caches.end(); ++file)
{
- std::string nuke = flNotDir(*file);
- if (strncmp(cachefile.c_str(), nuke.c_str(), cachefile.length()) != 0)
+ auto nuke = flNotDir(*file);
+ if (cachefile != nuke.substr(0, cachefile.length()))
continue;
RemoveFile("RemoveCaches", *file);
}