summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-01-23 15:02:48 +0100
committerJulian Andres Klode <jak@debian.org>2016-01-23 15:13:04 +0100
commit19819ac58a420275e0ae9aa7e2a34c72cba8af5e (patch)
tree3834146d4cd0084b9bbb87e1fb51237722af3cc8 /apt-pkg/pkgcachegen.cc
parent0c20302f5a02f9961b1a5c63913434ba03dcf3a0 (diff)
Pass the old map size to ReMap()
This allows us to check if a value to be remapped was inside the cache or not, which will become useful at a later point. Gbp-Dch: ignore
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc11
1 files changed, 7 insertions, 4 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;
}
/*}}}*/