X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f6777222f82f6279c104138216b0e5e50d8caa67..f8e8a14f17cb41c588970fc57bb41fcf6058a703:/apt-private/private-cacheset.h

diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h
index 0f7430fa0..37c921081 100644
--- a/apt-private/private-cacheset.h
+++ b/apt-private/private-cacheset.h
@@ -11,21 +11,30 @@
 #include <set>
 #include <string>
 
-#include <apti18n.h>
-
 class OpProgress;
 
+class VerIteratorWithCaching
+{
+   const pkgCache::VerIterator iter;
+   const pkgCache::DescFile * descFile;
+public:
+   VerIteratorWithCaching(const pkgCache::VerIterator& iter) :
+      iter(iter),
+      descFile(iter->DescriptionList != 0
+	 ? (const pkgCache::DescFile *) iter.TranslatedDescription().FileList()
+	 : nullptr)
+   {}
+   const pkgCache::DescFile * CachedDescFile() const { return descFile; }
+   operator pkgCache::VerIterator() const { return iter; }
+};
+
 struct VersionSortDescriptionLocality					/*{{{*/
 {
-   bool operator () (const pkgCache::VerIterator &v_lhs,
-	 const pkgCache::VerIterator &v_rhs)
+   bool operator () (const VerIteratorWithCaching &v_lhs,
+	 const VerIteratorWithCaching &v_rhs)
    {
-      pkgCache::DescFile const *A = nullptr;
-      pkgCache::DescFile const *B = nullptr;
-      if (v_lhs->DescriptionList != 0)
-	 A = v_lhs.TranslatedDescription().FileList();
-      if (v_rhs->DescriptionList != 0)
-	 B = v_rhs.TranslatedDescription().FileList();
+      pkgCache::DescFile const *A = v_lhs.CachedDescFile();
+      pkgCache::DescFile const *B = v_rhs.CachedDescFile();
 
       if (A == nullptr && B == nullptr)
 	 return false;
@@ -45,7 +54,7 @@ struct VersionSortDescriptionLocality					/*{{{*/
 									/*}}}*/
 // sorted by locality which makes iterating much faster
 typedef APT::VersionContainer<
-   std::set<pkgCache::VerIterator,
+   std::set<VerIteratorWithCaching,
             VersionSortDescriptionLocality> > LocalitySortedVersionSet;
 
 class Matcher {