summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 95e756c15..2c0cd1104 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -52,12 +52,13 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
group(Sim)
{
Sim.Init(0);
- Flags = new unsigned char[Cache->Head().PackageCount];
- memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
+ auto PackageCount = Cache->Head().PackageCount;
+ Flags = new unsigned char[PackageCount];
+ memset(Flags,0,sizeof(*Flags)*PackageCount);
// Fake a filename so as not to activate the media swapping
string Jnk = "SIMULATE";
- for (unsigned int I = 0; I != Cache->Head().PackageCount; I++)
+ for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
FileNames[I] = Jnk;
}
/*}}}*/
@@ -399,7 +400,7 @@ bool pkgFixBroken(pkgDepCache &Cache)
pkgProblemResolver::pkgProblemResolver(pkgDepCache *pCache) : d(NULL), Cache(*pCache)
{
// Allocate memory
- unsigned long Size = Cache.Head().PackageCount;
+ auto const Size = Cache.Head().PackageCount;
Scores = new int[Size];
Flags = new unsigned char[Size];
memset(Flags,0,sizeof(*Flags)*Size);
@@ -434,7 +435,7 @@ int pkgProblemResolver::ScoreSort(Package const *A,Package const *B)
/* */
void pkgProblemResolver::MakeScores()
{
- unsigned long Size = Cache.Head().PackageCount;
+ auto const Size = Cache.Head().PackageCount;
memset(Scores,0,sizeof(*Scores)*Size);
// maps to pkgCache::State::VerPriority:
@@ -753,7 +754,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
MakeScores();
- unsigned long const Size = Cache.Head().PackageCount;
+ auto const Size = Cache.Head().PackageCount;
/* We have to order the packages so that the broken fixing pass
operates from highest score to lowest. This prevents problems when
@@ -806,7 +807,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
{
if (Debug == true)
clog << " Try to Re-Instate (" << Counter << ") " << I.FullName(false) << endl;
- unsigned long OldBreaks = Cache.BrokenCount();
+ auto const OldBreaks = Cache.BrokenCount();
pkgCache::Version *OldVer = Cache[I].InstallVer;
Flags[I->ID] &= ReInstateTried;
@@ -1006,7 +1007,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
dangerous as it could trigger new breaks/conflicts… */
if (Debug == true)
clog << " Try Installing " << APT::PrettyPkg(&Cache, Start.TargetPkg()) << " before changing " << I.FullName(false) << std::endl;
- unsigned long const OldBroken = Cache.BrokenCount();
+ auto const OldBroken = Cache.BrokenCount();
Cache.MarkInstall(Start.TargetPkg(), true, 1, false);
// FIXME: we should undo the complete MarkInstall process here
if (Cache[Start.TargetPkg()].InstBroken() == true || Cache.BrokenCount() > OldBroken)
@@ -1211,14 +1212,13 @@ bool pkgProblemResolver::ResolveByKeepInternal()
{
pkgDepCache::ActionGroup group(Cache);
- unsigned long Size = Cache.Head().PackageCount;
-
MakeScores();
-
+
/* We have to order the packages so that the broken fixing pass
operates from highest score to lowest. This prevents problems when
high score packages cause the removal of lower score packages that
would cause the removal of even lower score packages. */
+ auto Size = Cache.Head().PackageCount;
pkgCache::Package **PList = new pkgCache::Package *[Size];
pkgCache::Package **PEnd = PList;
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)