From f9eec0e748c2e735980bf80445535d32f27f8301 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:52:56 +0000 Subject: performance tuning Author: jgg Date: 1999-02-23 06:46:24 GMT performance tuning --- apt-pkg/cacheiterators.h | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'apt-pkg/cacheiterators.h') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 6e71e8c8d..16088765d 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: cacheiterators.h,v 1.12 1999/02/01 02:22:11 jgg Exp $ +// $Id: cacheiterators.h,v 1.13 1999/02/23 06:46:24 jgg Exp $ /* ###################################################################### Cache Iterators - Iterators for navigating the cache structure @@ -93,17 +93,17 @@ class pkgCache::PkgIterator class pkgCache::VerIterator { Version *Ver; - pkgCache &Owner; + pkgCache *Owner; void _dummy(); public: // Iteration - void operator ++(int) {if (Ver != Owner.VerP) Ver = Owner.VerP + Ver->NextVer;}; + void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver->NextVer;}; inline void operator ++() {operator ++(0);}; - inline bool end() const {return Ver == Owner.VerP?true:false;}; - inline void operator =(const VerIterator &B) {Ver = B.Ver;}; + inline bool end() const {return Ver == Owner->VerP?true:false;}; + inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Owner;}; // Comparison inline bool operator ==(const VerIterator &B) const {return Ver == B.Ver;}; @@ -115,24 +115,26 @@ class pkgCache::VerIterator inline Version const *operator ->() const {return Ver;}; inline Version &operator *() {return *Ver;}; inline Version const &operator *() const {return *Ver;}; - inline operator Version *() {return Ver == Owner.VerP?0:Ver;}; - inline operator Version const *() const {return Ver == Owner.VerP?0:Ver;}; + inline operator Version *() {return Ver == Owner->VerP?0:Ver;}; + inline operator Version const *() const {return Ver == Owner->VerP?0:Ver;}; - inline const char *VerStr() const {return Ver->VerStr == 0?0:Owner.StrP + Ver->VerStr;}; - inline const char *Section() const {return Ver->Section == 0?0:Owner.StrP + Ver->Section;}; - inline const char *Arch() const {return Ver->Arch == 0?0:Owner.StrP + Ver->Arch;}; - inline PkgIterator ParentPkg() const {return PkgIterator(Owner,Owner.PkgP + Ver->ParentPkg);}; + inline const char *VerStr() const {return Ver->VerStr == 0?0:Owner->StrP + Ver->VerStr;}; + inline const char *Section() const {return Ver->Section == 0?0:Owner->StrP + Ver->Section;}; + inline const char *Arch() const {return Ver->Arch == 0?0:Owner->StrP + Ver->Arch;}; + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Ver->ParentPkg);}; inline DepIterator DependsList() const; inline PrvIterator ProvidesList() const; inline VerFileIterator FileList() const; - inline unsigned long Index() const {return Ver - Owner.VerP;}; + inline unsigned long Index() const {return Ver - Owner->VerP;}; bool Downloadable() const; const char *PriorityType(); bool Automatic() const; VerFileIterator NewestFile() const; - - inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg), Owner(Owner) + + inline VerIterator() : Ver(0), Owner(0) {}; + inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg), + Owner(&Owner) { if (Ver == 0) Ver = Owner.VerP; @@ -330,10 +332,10 @@ inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const {return PrvIterator(*Owner,Owner->ProvideP + Pkg->ProvidesList,Pkg);}; inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const - {return PrvIterator(Owner,Owner.ProvideP + Ver->ProvidesList,Ver);}; + {return PrvIterator(*Owner,Owner->ProvideP + Ver->ProvidesList,Ver);}; inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const - {return DepIterator(Owner,Owner.DepP + Ver->DependsList,Ver);}; + {return DepIterator(*Owner,Owner->DepP + Ver->DependsList,Ver);}; inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const - {return VerFileIterator(Owner,Owner.VerFileP + Ver->FileList);}; + {return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);}; #endif -- cgit v1.2.3