diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-08-11 20:53:28 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-08-11 20:53:28 +0200 |
commit | f7f0d6c7560a8f71707e7852a512469147aa9f84 (patch) | |
tree | 5bec681b4e798a2b35bea180213df399c51920d9 /apt-pkg/pkgcachegen.cc | |
parent | dd6882853b4555a6113740afca417acbaa060043 (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/pkgcachegen.cc')
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 2bfb77609..8a7c1e979 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -220,7 +220,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, // don't add a new description if we have one for the given // md5 && language - for ( ; Desc.end() == false; Desc++) + for ( ; Desc.end() == false; ++Desc) if (MD5SumValue(Desc.md5()) == CurMd5 && Desc.LanguageCode() == List.DescriptionLanguage()) duplicate=true; @@ -229,7 +229,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, for (Desc = Ver.DescriptionList(); Desc.end() == false; - LastDesc = &Desc->NextDesc, Desc++) + LastDesc = &Desc->NextDesc, ++Desc) { if (MD5SumValue(Desc.md5()) == CurMd5) { @@ -395,7 +395,7 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List) unsigned long Hash = List.VersionHash(); pkgCache::VerIterator Ver = Pkg.VersionList(); Dynamic<pkgCache::VerIterator> DynVer(Ver); - for (; Ver.end() == false; Ver++) + for (; Ver.end() == false; ++Ver) { if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr()) { @@ -511,7 +511,7 @@ bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver, // Link it to the end of the list map_ptrloc *Last = &Ver->FileList; - for (pkgCache::VerFileIterator V = Ver.FileList(); V.end() == false; V++) + for (pkgCache::VerFileIterator V = Ver.FileList(); V.end() == false; ++V) Last = &V->NextFile; VF->NextFile = *Last; *Last = VF.Index(); @@ -568,7 +568,7 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc, // Link it to the end of the list map_ptrloc *Last = &Desc->FileList; - for (pkgCache::DescFileIterator D = Desc.FileList(); D.end() == false; D++) + for (pkgCache::DescFileIterator D = Desc.FileList(); D.end() == false; ++D) Last = &D->NextFile; DF->NextFile = *Last; @@ -623,7 +623,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) // Create Conflicts in between the group pkgCache::GrpIterator G = GetCache().GrpBegin(); Dynamic<pkgCache::GrpIterator> DynG(G); - for (; G.end() != true; G++) + for (; G.end() != true; ++G) { string const PkgName = G.Name(); pkgCache::PkgIterator P = G.PackageList(); @@ -634,7 +634,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg); pkgCache::VerIterator V = P.VersionList(); Dynamic<pkgCache::VerIterator> DynV(V); - for (; V.end() != true; V++) + for (; V.end() != true; ++V) { // copy P.Arch() into a string here as a cache remap // in NewDepends() later may alter the pointer location @@ -728,7 +728,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, if (OldDepLast == NULL) { OldDepLast = &Ver->DependsList; - for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++) + for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D) OldDepLast = &D->NextDepends; } else if (oldMap != Map.Data()) OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; @@ -958,7 +958,7 @@ static bool CheckValidity(const string &CacheFile, verify the IMS data and check that it is on the disk too.. */ SPtrArray<bool> Visited = new bool[Cache.HeaderP->PackageFileCount]; memset(Visited,0,sizeof(*Visited)*Cache.HeaderP->PackageFileCount); - for (; Start != End; Start++) + for (; Start != End; ++Start) { if (Debug == true) std::clog << "Checking PkgFile " << (*Start)->Describe() << ": "; @@ -1025,7 +1025,7 @@ static bool CheckValidity(const string &CacheFile, static unsigned long ComputeSize(FileIterator Start,FileIterator End) { unsigned long TotalSize = 0; - for (; Start != End; Start++) + for (; Start != End; ++Start) { if ((*Start)->HasPackages() == false) continue; @@ -1043,7 +1043,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, FileIterator Start, FileIterator End) { FileIterator I; - for (I = Start; I != End; I++) + for (I = Start; I != End; ++I) { if ((*I)->HasPackages() == false) continue; @@ -1073,7 +1073,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, Progress->Done(); TotalSize = ComputeSize(Start, End); CurrentSize = 0; - for (I = Start; I != End; I++) + for (I = Start; I != End; ++I) { unsigned long Size = (*I)->Size(); if (Progress != NULL) @@ -1120,12 +1120,12 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress vector<pkgIndexFile *> Files; for (vector<metaIndex *>::const_iterator i = List.begin(); i != List.end(); - i++) + ++i) { vector <pkgIndexFile *> *Indexes = (*i)->GetIndexFiles(); for (vector<pkgIndexFile *>::const_iterator j = Indexes->begin(); j != Indexes->end(); - j++) + ++j) Files.push_back (*j); } |