1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 20:51:00 +01:00

* Simplification: registerSubstitutes -> registerSubstitute. We no

longer need the former since there we no longer have the
  substitutes-rev table (which triggered a O(n^2) cost in updating
  them).
This commit is contained in:
Eelco Dolstra 2005-01-25 20:27:40 +00:00
parent a9340fa672
commit 2a2756b856
4 changed files with 12 additions and 24 deletions

View file

@ -331,26 +331,19 @@ static void writeSubstitutes(const Transaction & txn,
}
void registerSubstitutes(const Transaction & txn,
const SubstitutePairs & subPairs)
void registerSubstitute(const Transaction & txn,
const Path & srcPath, const Substitute & sub)
{
for (SubstitutePairs::const_iterator i = subPairs.begin();
i != subPairs.end(); ++i)
{
const Path & srcPath(i->first);
const Substitute & sub(i->second);
assertStorePath(srcPath);
assertStorePath(srcPath);
Substitutes subs = readSubstitutes(txn, srcPath);
Substitutes subs = readSubstitutes(txn, srcPath);
/* New substitutes take precedence over old ones. If the
substitute is already present, it's moved to the front. */
remove(subs.begin(), subs.end(), sub);
subs.push_front(sub);
/* New substitutes take precedence over old ones. If the
substitute is already present, it's moved to the front. */
remove(subs.begin(), subs.end(), sub);
subs.push_front(sub);
writeSubstitutes(txn, srcPath, subs);
}
writeSubstitutes(txn, srcPath, subs);
}