summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-01-31 05:53:50 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2017-01-31 05:53:50 -0800
commitc2fb49ca1783b9ea2dd8b7cb90a2284750076c65 (patch)
treedb40244c6491969ad652a4c257e36e6e44d20085 /apt-pkg/pkgcachegen.cc
parentf6877b4806585106a204cddcbc4640fc1d4a93ed (diff)
Port TagIterator to correctly support ReMap (doh).
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 8ee682db8..7152f04e2 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -175,6 +175,10 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
i != Dynamic<pkgCache::VerIterator>::toReMap.end(); ++i)
if (std::get<1>(seen.insert(*i)) == true)
(*i)->ReMap(oldMap, newMap);
+ for (std::vector<pkgCache::TagIterator*>::const_iterator i = Dynamic<pkgCache::TagIterator>::toReMap.begin();
+ i != Dynamic<pkgCache::TagIterator>::toReMap.end(); ++i)
+ if (std::get<1>(seen.insert(*i)) == true)
+ (*i)->ReMap(oldMap, newMap);
for (std::vector<pkgCache::DepIterator*>::const_iterator i = Dynamic<pkgCache::DepIterator>::toReMap.begin();
i != Dynamic<pkgCache::DepIterator>::toReMap.end(); ++i)
if (std::get<1>(seen.insert(*i)) == true)
@@ -1290,18 +1294,20 @@ bool pkgCacheGenerator::NewTag(pkgCache::VerIterator &Ver,
unsigned int NameSize)
{
// Get a structure
- unsigned long Tagg = AllocateInMap(sizeof(pkgCache::Tag));
- if (Tagg == 0)
+ map_pointer_t const idxTag = AllocateInMap(sizeof(pkgCache::Tag));
+ if (unlikely(idxTag == 0))
return false;
- Cache.HeaderP->TagCount++;
// Fill it in
- pkgCache::TagIterator Tg(Cache,Cache.TagP + Tagg);
- Tg->Name = WriteStringInMap(NameStart,NameSize);
- if (Tg->Name == 0)
+ pkgCache::TagIterator Tg(Cache,Cache.TagP + idxTag);
+ map_pointer_t const idxName = WriteStringInMap(NameStart,NameSize);
+ if (idxName == 0)
return false;
+ Tg->Name = idxName;
+
Tg->NextTag = Ver->TagList;
Ver->TagList = Tg.Index();
+ Cache.HeaderP->TagCount++;
return true;
}