summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/pkgcachegen.cc11
-rw-r--r--apt-pkg/pkgcachegen.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 43347cf65..a472babeb 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -141,7 +141,7 @@ pkgCacheGenerator::~pkgCacheGenerator()
Map.Sync(0,sizeof(pkgCache::Header));
}
/*}}}*/
-void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newMap) {/*{{{*/
+void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newMap, size_t oldSize) {/*{{{*/
if (oldMap == newMap)
return;
@@ -181,27 +181,30 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
// CacheGenerator::WriteStringInMap /*{{{*/
map_stringitem_t pkgCacheGenerator::WriteStringInMap(const char *String,
const unsigned long &Len) {
+ size_t oldSize = Map.Size();
void const * const oldMap = Map.Data();
map_stringitem_t const index = Map.WriteString(String, Len);
if (index != 0)
- ReMap(oldMap, Map.Data());
+ ReMap(oldMap, Map.Data(), oldSize);
return index;
}
/*}}}*/
// CacheGenerator::WriteStringInMap /*{{{*/
map_stringitem_t pkgCacheGenerator::WriteStringInMap(const char *String) {
+ size_t oldSize = Map.Size();
void const * const oldMap = Map.Data();
map_stringitem_t const index = Map.WriteString(String);
if (index != 0)
- ReMap(oldMap, Map.Data());
+ ReMap(oldMap, Map.Data(), oldSize);
return index;
}
/*}}}*/
map_pointer_t pkgCacheGenerator::AllocateInMap(const unsigned long &size) {/*{{{*/
+ size_t oldSize = Map.Size();
void const * const oldMap = Map.Data();
map_pointer_t const index = Map.Allocate(size);
if (index != 0)
- ReMap(oldMap, Map.Data());
+ ReMap(oldMap, Map.Data(), oldSize);
return index;
}
/*}}}*/
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index d8d1e303a..ea288ad6e 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -149,7 +149,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
MMap **OutMap,pkgCache **OutCache, bool AllowMem = false);
APT_PUBLIC static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap);
- void ReMap(void const * const oldMap, void const * const newMap);
+ void ReMap(void const * const oldMap, void const * const newMap, size_t oldSize);
pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
virtual ~pkgCacheGenerator();