summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-07-08 15:28:53 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-07-08 15:28:53 +0200
commita9fe592842bfa17d91f4904d7fb0e3af3adebb17 (patch)
tree711c7ddc538476e8b88dfb8b6d76361db5754c1e /apt-pkg/pkgcachegen.h
parent32b9a14cb4c6bdcddfe84c4451c225ced1a34bb7 (diff)
* apt-pkg/pkgcachegen.{cc,h}:
- make the used MMap moveable (and therefore dynamic resizeable) by applying (some) mad pointer magic (Closes: #195018)
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r--apt-pkg/pkgcachegen.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index 8f7739165..3bee1f958 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -23,6 +23,8 @@
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/md5.h>
+#include <set>
+
class pkgSourceList;
class OpProgress;
class MMap;
@@ -33,18 +35,32 @@ class pkgCacheGenerator /*{{{*/
private:
pkgCache::StringItem *UniqHash[26];
- unsigned long WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); };
- unsigned long WriteStringInMap(const char *String);
- unsigned long WriteStringInMap(const char *String, const unsigned long &Len);
- unsigned long AllocateInMap(const unsigned long &size);
+ map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); };
+ map_ptrloc WriteStringInMap(const char *String);
+ map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len);
+ map_ptrloc AllocateInMap(const unsigned long &size);
public:
class ListParser;
friend class ListParser;
-
+
+ template<typename Iter> class Dynamic {
+ Iter *I;
+
+ public:
+ static std::set<Iter*> toReMap;
+ Dynamic(Iter &It) : I(&It) {
+ toReMap.insert(I);
+ }
+
+ ~Dynamic() {
+ toReMap.erase(I);
+ }
+ };
+
protected:
-
+
DynamicMMap &Map;
pkgCache Cache;
OpProgress *Progress;
@@ -86,6 +102,8 @@ class pkgCacheGenerator /*{{{*/
MMap **OutMap = 0,bool AllowMem = false);
static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap);
+ void ReMap(void const * const oldMap, void const * const newMap);
+
pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
~pkgCacheGenerator();
};