diff options
author | Julian Andres Klode <jak@debian.org> | 2015-12-29 15:59:41 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2015-12-29 16:29:05 +0100 |
commit | f161603953f92cc3e778439d7149e5b852f65277 (patch) | |
tree | 3762e10147ae26ad56a98483a4bf9a5b98a2dd27 /apt-pkg/cachefile.cc | |
parent | 67c90775b650efe89d7d784cf913526cc3b63d07 (diff) |
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.
Diffstat (limited to 'apt-pkg/cachefile.cc')
-rw-r--r-- | apt-pkg/cachefile.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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; |