depcache.cc: optimize CheckDep() calls for Now/Install/Candidate versions

This commit is contained in:
Alexey Tourbin 2011-01-25 06:41:24 +03:00
parent 5a8f69df6a
commit c3ca6b81bc

View File

@ -506,9 +506,19 @@ unsigned char pkgDepCache::DependencyState(DepIterator &D)
if (CheckDep(D,NowVersion) == true)
State |= DepNow;
if (CheckDep(D,InstallVersion) == true)
PkgIterator Pkg = D.TargetPkg();
Version *CurrentVer = Pkg.CurrentVer();
Version *InstallVer = PkgState[Pkg->ID].InstallVer;
Version *CandidateVer = PkgState[Pkg->ID].CandidateVer;
if ((InstallVer == CurrentVer && (State & DepNow)) ||
CheckDep(D,InstallVersion) == true)
State |= DepInstall;
if (CheckDep(D,CandidateVersion) == true)
if ((CandidateVer == CurrentVer && (State & DepNow)) ||
(CandidateVer == InstallVer && (State & DepInstall)) ||
CheckDep(D,CandidateVersion) == true)
State |= DepCVer;
return State;