From c9d715346cae0bd53264d7c25d5af79ca6365707 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Aug 2015 11:05:57 +0200 Subject: Fix an obscure warning from GCC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It complained about the previous code: apt-pkg/sourcelist.cc: In destructor ‘pkgSourceList::~pkgSourceList()’: apt-pkg/sourcelist.cc:278:4: warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] for (pkgIndexFile * const File : VolatileFiles) ^ There really cannot be an overflow, though. Rewriting it like this seems to fix it. --- apt-pkg/sourcelist.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/sourcelist.cc') diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 46e51f592..3e714667c 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -275,8 +275,8 @@ pkgSourceList::~pkgSourceList() for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I) delete *I; SrcList.clear(); - for (pkgIndexFile * const File : VolatileFiles) - delete File; + for (auto F = VolatileFiles.begin(); F != VolatileFiles.end(); ++F) + delete (*F); VolatileFiles.clear(); } /*}}}*/ -- cgit v1.2.3