ソースを参照

Drop the Section field from pkgCache::Package again

This somehow got back, we don't really know why. Emulate the
Section() method in the PkgIterator by looking at the section
of the head of the VersionList.
Julian Andres Klode 11 年 前
コミット
a1dfe33790
共有2 個のファイルを変更した3 個の追加11 個の削除を含む
  1. 3 5
      apt-pkg/cacheiterators.h
  2. 0 6
      apt-pkg/pkgcache.h

+ 3 - 5
apt-pkg/cacheiterators.h

@@ -157,11 +157,7 @@ class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
 	inline const char *Name() const { return Group().Name(); }
 	inline const char *Name() const { return Group().Name(); }
 	// Versions have sections - and packages can have different versions with different sections
 	// Versions have sections - and packages can have different versions with different sections
 	// so this interface is broken by design. Run as fast as you can to Version.Section().
 	// so this interface is broken by design. Run as fast as you can to Version.Section().
-	APT_DEPRECATED inline const char *Section() const {
-	   APT_IGNORE_DEPRECATED_PUSH
-	   return S->Section == 0?0:Owner->StrP + S->Section;
-	   APT_IGNORE_DEPRECATED_POP
-	}
+	APT_DEPRECATED inline const char *Section() const;
 	inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge ||
 	inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge ||
 		(S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}
 		(S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}
 	inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}
 	inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}
@@ -518,5 +514,7 @@ inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
        {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}
        {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}
 inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
 inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
        {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}
        {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}
+APT_DEPRECATED inline const char * pkgCache::PkgIterator::Section() const
+       {return S->VersionList == 0 ? 0 : VersionList().Section();}
 									/*}}}*/
 									/*}}}*/
 #endif
 #endif

+ 0 - 6
apt-pkg/pkgcache.h

@@ -429,12 +429,6 @@ struct pkgCache::Package
    map_pointer_t VersionList;       // Version
    map_pointer_t VersionList;       // Version
    /** \brief index to the installed version */
    /** \brief index to the installed version */
    map_pointer_t CurrentVer;        // Version
    map_pointer_t CurrentVer;        // Version
-   /** \brief indicates nothing (consistently)
-       This field used to contain ONE section the package belongs to,
-       if those differs between versions it is a RANDOM one.
-       The Section() method tries to reproduce it, but the only sane
-       thing to do is use the Section field from the version! */
-   APT_DEPRECATED map_ptrloc Section; // StringItem
    /** \brief index of the group this package belongs to */
    /** \brief index of the group this package belongs to */
    map_pointer_t Group;             // Group the Package belongs to
    map_pointer_t Group;             // Group the Package belongs to