summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-08-11 20:53:28 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-08-11 20:53:28 +0200
commitf7f0d6c7560a8f71707e7852a512469147aa9f84 (patch)
tree5bec681b4e798a2b35bea180213df399c51920d9 /apt-pkg/depcache.cc
parentdd6882853b4555a6113740afca417acbaa060043 (diff)
cppcheck complains about some possible speed improvements which could be
done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types.
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r--apt-pkg/depcache.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index eb3f4e598..580056687 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -129,7 +129,7 @@ bool pkgDepCache::Init(OpProgress *Prog)
/* Set the current state of everything. In this state all of the
packages are kept exactly as is. See AllUpgrade */
int Done = 0;
- for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++)
+ for (PkgIterator I = PkgBegin(); I.end() != true; ++I, ++Done)
{
if (Prog != 0 && Done%20 == 0)
Prog->Progress(Done);
@@ -292,7 +292,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) /*{{{*/
// then write the ones we have not seen yet
std::ostringstream ostr;
- for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end(); pkg++) {
+ for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end(); ++pkg) {
StateCache const &P = PkgState[pkg->ID];
if(P.Flags & Flag::Auto) {
if (pkgs_seen.find(pkg.FullName()) != pkgs_seen.end()) {
@@ -365,7 +365,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
// Check the providing packages
PrvIterator P = Dep.TargetPkg().ProvidesList();
PkgIterator Pkg = Dep.ParentPkg();
- for (; P.end() != true; P++)
+ for (; P.end() != true; ++P)
{
/* Provides may never be applied against the same package (or group)
if it is a conflicts. See the comment above. */
@@ -585,7 +585,7 @@ void pkgDepCache::BuildGroupOrs(VerIterator const &V)
{
unsigned char Group = 0;
- for (DepIterator D = V.DependsList(); D.end() != true; D++)
+ for (DepIterator D = V.DependsList(); D.end() != true; ++D)
{
// Build the dependency state.
unsigned char &State = DepState[D->ID];
@@ -625,7 +625,7 @@ unsigned char pkgDepCache::VersionState(DepIterator D,unsigned char Check,
// Compute a single dependency element (glob or)
DepIterator Start = D;
unsigned char State = 0;
- for (bool LastOR = true; D.end() == false && LastOR == true; D++)
+ for (bool LastOR = true; D.end() == false && LastOR == true; ++D)
{
State |= DepState[D->ID];
LastOR = (D->CompareOp & Dep::Or) == Dep::Or;
@@ -715,15 +715,15 @@ void pkgDepCache::Update(OpProgress *Prog)
// Perform the depends pass
int Done = 0;
- for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++)
+ for (PkgIterator I = PkgBegin(); I.end() != true; ++I, ++Done)
{
if (Prog != 0 && Done%20 == 0)
Prog->Progress(Done);
- for (VerIterator V = I.VersionList(); V.end() != true; V++)
+ for (VerIterator V = I.VersionList(); V.end() != true; ++V)
{
unsigned char Group = 0;
- for (DepIterator D = V.DependsList(); D.end() != true; D++)
+ for (DepIterator D = V.DependsList(); D.end() != true; ++D)
{
// Build the dependency state.
unsigned char &State = DepState[D->ID];
@@ -760,7 +760,7 @@ void pkgDepCache::Update(OpProgress *Prog)
void pkgDepCache::Update(DepIterator D)
{
// Update the reverse deps
- for (;D.end() != true; D++)
+ for (;D.end() != true; ++D)
{
unsigned char &State = DepState[D->ID];
State = DependencyState(D);
@@ -793,13 +793,13 @@ void pkgDepCache::Update(PkgIterator const &Pkg)
// Update the provides map for the current ver
if (Pkg->CurrentVer != 0)
for (PrvIterator P = Pkg.CurrentVer().ProvidesList();
- P.end() != true; P++)
+ P.end() != true; ++P)
Update(P.ParentPkg().RevDependsList());
// Update the provides map for the candidate ver
if (PkgState[Pkg->ID].CandidateVer != 0)
for (PrvIterator P = PkgState[Pkg->ID].CandidateVerIter(*this).ProvidesList();
- P.end() != true; P++)
+ P.end() != true; ++P)
Update(P.ParentPkg().RevDependsList());
}
/*}}}*/
@@ -1059,7 +1059,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
DepIterator Start = Dep;
bool Result = true;
unsigned Ors = 0;
- for (bool LastOR = true; Dep.end() == false && LastOR == true; Dep++,Ors++)
+ for (bool LastOR = true; Dep.end() == false && LastOR == true; ++Dep, ++Ors)
{
LastOR = (Dep->CompareOp & Dep::Or) == Dep::Or;
@@ -1522,12 +1522,12 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator const &Pk
unless they are already installed */
VerIterator Last(*(pkgCache *)this,0);
- for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
+ for (VerIterator I = Pkg.VersionList(); I.end() == false; ++I)
{
if (Pkg.CurrentVer() == I)
return I;
- for (VerFileIterator J = I.FileList(); J.end() == false; J++)
+ for (VerFileIterator J = I.FileList(); J.end() == false; ++J)
{
if ((J.File()->Flags & Flag::NotSource) != 0)
continue;