From 2a2756b85643de6355b7b9e3cc47574e7df82303 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 25 Jan 2005 20:27:40 +0000 Subject: * 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). --- src/libstore/store.cc | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/libstore/store.cc') diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 02bf9803b29c..0dd4e1ed2553 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -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); } -- cgit 1.4.1