diff options
| author | Julian Andres Klode <jak@debian.org> | 2026-04-08 10:41:49 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-04-08 10:41:49 +0000 |
| commit | 65b3ff4a262e73a71467f1aab5bdf2e1a9e00170 (patch) | |
| tree | 1f40f2afce10e3b793540e9905b624f113c2ee15 /apt-pkg/pkgcachegen.cc | |
| parent | fbde7ea4ce304a30e155a2bd9d014d196abbb496 (diff) | |
| parent | 23dba65f031954df896bc3c6dfb1a9705574886b (diff) | |
Merge branch 'make-unique' into 'main'
apt: modernize to make_unique C++17
See merge request apt-team/apt!567
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
| -rw-r--r-- | apt-pkg/pkgcachegen.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 7bf635972..82b88d6b0 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1502,10 +1502,10 @@ static bool CheckValidity(FileFd &CacheFile, std::string const &CacheFileName, } // Map it - std::unique_ptr<MMap> Map(new MMap(CacheFile,0)); + auto Map = std::make_unique<MMap>(CacheFile,0); if (unlikely(Map->validData()) == false) return false; - std::unique_ptr<pkgCache> CacheP(new pkgCache(Map.get())); + auto CacheP = std::make_unique<pkgCache>(Map.get()); pkgCache &Cache = *CacheP.get(); if (_error->PendingError() || Map->Size() == 0) { @@ -1514,7 +1514,7 @@ static bool CheckValidity(FileFd &CacheFile, std::string const &CacheFileName, return false; } - std::unique_ptr<bool[]> RlsVisited(new bool[Cache.HeaderP->ReleaseFileCount]); + auto RlsVisited = std::make_unique<bool[]>(Cache.HeaderP->ReleaseFileCount); memset(RlsVisited.get(),0,sizeof(RlsVisited[0])*Cache.HeaderP->ReleaseFileCount); std::vector<pkgIndexFile *> Files; for (pkgSourceList::const_iterator i = List.begin(); i != List.end(); ++i) @@ -1549,7 +1549,7 @@ static bool CheckValidity(FileFd &CacheFile, std::string const &CacheFileName, /* Now we check every index file, see if it is in the cache, verify the IMS data and check that it is on the disk too.. */ - std::unique_ptr<bool[]> Visited(new bool[Cache.HeaderP->PackageFileCount]); + auto Visited = std::make_unique<bool[]>(Cache.HeaderP->PackageFileCount); memset(Visited.get(),0,sizeof(Visited[0])*Cache.HeaderP->PackageFileCount); for (std::vector<pkgIndexFile *>::const_reverse_iterator PkgFile = Files.rbegin(); PkgFile != Files.rend(); ++PkgFile) { @@ -1927,7 +1927,7 @@ bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **O return false; ScopedErrorMerge sem; - std::unique_ptr<DynamicMMap> Map(CreateDynamicMMap(NULL, 0)); + auto Map = std::make_unique<DynamicMMap>(NULL, 0); if (unlikely(Map->validData()) == false) return false; map_filesize_t CurrentSize = 0; |
