]> git.saurik.com Git - apt.git/commitdiff
switch from std::set to std::vector as it is way more simple, a bit
authorDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 9 Jul 2010 17:51:19 +0000 (19:51 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 9 Jul 2010 17:51:19 +0000 (19:51 +0200)
faster and still provides everything we need for the Cache generator

apt-pkg/pkgcachegen.cc
apt-pkg/pkgcachegen.h

index 7ca8fbfdaa27b6afd00b959f5a005fd3ebea6b03..1175d51298a5966716606635a7006421ae37acd4 100644 (file)
@@ -36,7 +36,7 @@
 #include <stdio.h>
                                                                        /*}}}*/
 typedef vector<pkgIndexFile *>::iterator FileIterator;
 #include <stdio.h>
                                                                        /*}}}*/
 typedef vector<pkgIndexFile *>::iterator FileIterator;
-template <typename Iter> std::set<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
+template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap(6);
 
 // CacheGenerator::pkgCacheGenerator - Constructor                     /*{{{*/
 // ---------------------------------------------------------------------
 
 // CacheGenerator::pkgCacheGenerator - Constructor                     /*{{{*/
 // ---------------------------------------------------------------------
@@ -113,25 +113,25 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
       if (UniqHash[i] != 0)
         UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap;
 
       if (UniqHash[i] != 0)
         UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap;
 
-   for (std::set<pkgCache::GrpIterator*>::const_iterator i = Dynamic<pkgCache::GrpIterator>::toReMap.begin();
+   for (std::vector<pkgCache::GrpIterator*>::const_iterator i = Dynamic<pkgCache::GrpIterator>::toReMap.begin();
        i != Dynamic<pkgCache::GrpIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
        i != Dynamic<pkgCache::GrpIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
-   for (std::set<pkgCache::PkgIterator*>::const_iterator i = Dynamic<pkgCache::PkgIterator>::toReMap.begin();
+   for (std::vector<pkgCache::PkgIterator*>::const_iterator i = Dynamic<pkgCache::PkgIterator>::toReMap.begin();
        i != Dynamic<pkgCache::PkgIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
        i != Dynamic<pkgCache::PkgIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
-   for (std::set<pkgCache::VerIterator*>::const_iterator i = Dynamic<pkgCache::VerIterator>::toReMap.begin();
+   for (std::vector<pkgCache::VerIterator*>::const_iterator i = Dynamic<pkgCache::VerIterator>::toReMap.begin();
        i != Dynamic<pkgCache::VerIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
        i != Dynamic<pkgCache::VerIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
-   for (std::set<pkgCache::DepIterator*>::const_iterator i = Dynamic<pkgCache::DepIterator>::toReMap.begin();
+   for (std::vector<pkgCache::DepIterator*>::const_iterator i = Dynamic<pkgCache::DepIterator>::toReMap.begin();
        i != Dynamic<pkgCache::DepIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
        i != Dynamic<pkgCache::DepIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
-   for (std::set<pkgCache::DescIterator*>::const_iterator i = Dynamic<pkgCache::DescIterator>::toReMap.begin();
+   for (std::vector<pkgCache::DescIterator*>::const_iterator i = Dynamic<pkgCache::DescIterator>::toReMap.begin();
        i != Dynamic<pkgCache::DescIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
        i != Dynamic<pkgCache::DescIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
-   for (std::set<pkgCache::PrvIterator*>::const_iterator i = Dynamic<pkgCache::PrvIterator>::toReMap.begin();
+   for (std::vector<pkgCache::PrvIterator*>::const_iterator i = Dynamic<pkgCache::PrvIterator>::toReMap.begin();
        i != Dynamic<pkgCache::PrvIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
        i != Dynamic<pkgCache::PrvIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
-   for (std::set<pkgCache::PkgFileIterator*>::const_iterator i = Dynamic<pkgCache::PkgFileIterator>::toReMap.begin();
+   for (std::vector<pkgCache::PkgFileIterator*>::const_iterator i = Dynamic<pkgCache::PkgFileIterator>::toReMap.begin();
        i != Dynamic<pkgCache::PkgFileIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
 }                                                                      /*}}}*/
        i != Dynamic<pkgCache::PkgFileIterator>::toReMap.end(); ++i)
       (*i)->ReOwn(Cache, oldMap, newMap);
 }                                                                      /*}}}*/
index 20dd28030e4e03539573f82216f5a41645fe6ad4..ff198833a801f9cd601e25980ff5470d303b5128 100644 (file)
@@ -23,7 +23,7 @@
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/md5.h>
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/md5.h>
 
-#include <set>
+#include <vector>
 
 class pkgSourceList;
 class OpProgress;
 
 class pkgSourceList;
 class OpProgress;
@@ -46,16 +46,14 @@ class pkgCacheGenerator                                                     /*{{{*/
    friend class ListParser;
 
    template<typename Iter> class Dynamic {
    friend class ListParser;
 
    template<typename Iter> class Dynamic {
-      Iter *I;
-
       public:
       public:
-      static std::set<Iter*> toReMap;
-      Dynamic(Iter &It) : I(&It) {
-        toReMap.insert(I);
+      static std::vector<Iter*> toReMap;
+      Dynamic(Iter &I) {
+        toReMap.push_back(&I);
       }
 
       ~Dynamic() {
       }
 
       ~Dynamic() {
-        toReMap.erase(I);
+        toReMap.pop_back();
       }
    };
 
       }
    };