From f161603953f92cc3e778439d7149e5b852f65277 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 29 Dec 2015 15:59:41 +0100 Subject: pkgCacheGenerator: Allow passing down an already created cache If we already have opened a cache, there is no point in having to open it again. --- apt-pkg/cachefile.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apt-pkg/cachefile.cc') diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 39f1e72db..92a3b201b 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -96,7 +96,8 @@ bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock) BuildSourceList(Progress); // Read the caches - bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,Progress,&Map, true); + Cache = nullptr; + bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,Progress,&Map, &Cache, true); if (Progress != NULL) Progress->Done(); if (Res == false) @@ -106,7 +107,8 @@ bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock) if (_error->PendingError() == true) _error->Warning(_("You may want to run apt-get update to correct these problems")); - Cache = new pkgCache(Map); + if (Cache == nullptr) + Cache = new pkgCache(Map); if (_error->PendingError() == true) return false; return true; -- cgit v1.2.3