diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-02-03 12:58:23 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-02-03 13:50:00 +0100 |
commit | cd907113561d5eb75054f981be3bcc22eee8db27 (patch) | |
tree | 4ebe210982c5a334c5d88bbedec655f54e3afd8a /apt-private | |
parent | 1051eb835914196e326a53f76ca706f4d422d633 (diff) |
use pkgCache::VS instead of pkgDepCache::VS()
The later just calls the earlier, but the later needs the fullblown
dependency cache to be initialized, which is a very costly operation and
isn't done anymore that early in the run as we would need to throw away
and rebuild it again after we got all the information about source pkgs.
As we end up with a nullptr for the pkgDepCache, we use a slightly
longer calling convention to make sure that we use the pkgCache
directly, avoiding nullptr induced segfaults and costly operations.
Git-Dch: Ignore
Reported-By: Balint Reczey <balint@balintreczey.hu>
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-source.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index c45af6651..c2f5f5d3a 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -152,12 +152,12 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, // pick highest version for the arch unless the user wants // something else if (ArchTag != "" && VerTag == "" && RelTag == "") - if(Cache->VS().CmpVersion(VerTag, Ver.VerStr()) < 0) + if(Cache.GetPkgCache()->VS->CmpVersion(VerTag, Ver.VerStr()) < 0) VerTag = Ver.VerStr(); // We match against a concrete version (or a part of this version) if (VerTag.empty() == false && - (fuzzy == true || Cache->VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match + (fuzzy == true || Cache.GetPkgCache()->VS->CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match (fuzzy == false || strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)) // fuzzy match continue; @@ -275,11 +275,11 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, // Ignore all versions which doesn't fit if (VerTag.empty() == false && - Cache->VS().CmpVersion(VerTag, Ver) != 0) // exact match + Cache.GetPkgCache()->VS->CmpVersion(VerTag, Ver) != 0) // exact match continue; // Newer version or an exact match? Save the hit - if (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0) { + if (Last == 0 || Cache.GetPkgCache()->VS->CmpVersion(Version,Ver) < 0) { Last = Parse; Offset = Parse->Offset(); Version = Ver; @@ -514,7 +514,7 @@ bool DoSource(CommandLine &CmdL) bool const fixBroken = _config->FindB("APT::Get::Fix-Broken", false); for (unsigned I = 0; I != J; ++I) { - std::string Dir = Dsc[I].Package + '-' + Cache->VS().UpstreamVersion(Dsc[I].Version.c_str()); + std::string Dir = Dsc[I].Package + '-' + Cache.GetPkgCache()->VS->UpstreamVersion(Dsc[I].Version.c_str()); // Diff only mode only fetches .diff files if (_config->FindB("APT::Get::Diff-Only",false) == true || |