From 4fad7262291a8af1415fb9a3693678bd9610f0d6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 24 Feb 2020 17:46:10 +0100 Subject: Make map_pointer typesafe Instead of just using uint32_t, which would allow you to assign e.g. a map_pointer to a map_pointer, use our own smarter struct that has strict type checking. We allow creating a map_pointer from a nullptr, and we allow comparing map_pointer to nullptr, which also deals with comparisons against 0 which are often used, as 0 will be implictly converted to nullptr. --- apt-pkg/pkgcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 59f4256ea..02448a073 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -451,7 +451,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const LastPkg.end() == true)) return PkgIterator(*Owner, 0); - if (S->LastPackage == LastPkg.Index()) + if (S->LastPackage == LastPkg.MapPointer()) return PkgIterator(*Owner, 0); return PkgIterator(*Owner, Owner->PkgP + LastPkg->NextPackage); -- cgit v1.2.3