* Use foreach in a lot of places.
This commit is contained in:
		
							parent
							
								
									8f1bf28505
								
							
						
					
					
						commit
						d5eab2fc82
					
				
					 10 changed files with 59 additions and 96 deletions
				
			
		|  | @ -290,13 +290,11 @@ void Goal::waiteeDone(GoalPtr waitee, ExitCode result) | |||
| 
 | ||||
|         /* If we failed and keepGoing is not set, we remove all
 | ||||
|            remaining waitees. */ | ||||
|         for (Goals::iterator i = waitees.begin(); i != waitees.end(); ++i) { | ||||
|         foreach (Goals::iterator, i, waitees) { | ||||
|             GoalPtr goal = *i; | ||||
|             WeakGoals waiters2; | ||||
|             for (WeakGoals::iterator j = goal->waiters.begin(); | ||||
|                  j != goal->waiters.end(); ++j) | ||||
|                 if (j->lock() != shared_from_this()) | ||||
|                     waiters2.insert(*j); | ||||
|             foreach (WeakGoals::iterator, j, goal->waiters) | ||||
|                 if (j->lock() != shared_from_this()) waiters2.insert(*j); | ||||
|             goal->waiters = waiters2; | ||||
|         } | ||||
|         waitees.clear(); | ||||
|  | @ -312,7 +310,7 @@ void Goal::amDone(ExitCode result) | |||
|     assert(exitCode == ecBusy); | ||||
|     assert(result == ecSuccess || result == ecFailed); | ||||
|     exitCode = result; | ||||
|     for (WeakGoals::iterator i = waiters.begin(); i != waiters.end(); ++i) { | ||||
|     foreach (WeakGoals::iterator, i, waiters) { | ||||
|         GoalPtr goal = i->lock(); | ||||
|         if (goal) goal->waiteeDone(shared_from_this(), result); | ||||
|     } | ||||
|  | @ -365,8 +363,7 @@ const char * * strings2CharPtrs(const Strings & ss) | |||
| { | ||||
|     const char * * arr = new const char * [ss.size() + 1]; | ||||
|     const char * * p = arr; | ||||
|     for (Strings::const_iterator i = ss.begin(); i != ss.end(); ++i) | ||||
|         *p++ = i->c_str(); | ||||
|     foreach (Strings::const_iterator, i, ss) *p++ = i->c_str(); | ||||
|     *p = 0; | ||||
|     return arr; | ||||
| } | ||||
|  | @ -462,7 +459,7 @@ void UserLock::acquire() | |||
| 
 | ||||
|     /* Find a user account that isn't currently in use for another
 | ||||
|        build. */ | ||||
|     for (Strings::iterator i = users.begin(); i != users.end(); ++i) { | ||||
|     foreach (Strings::iterator, i, users) { | ||||
|         debug(format("trying user `%1%'") % *i); | ||||
| 
 | ||||
|         struct passwd * pw = getpwnam(i->c_str()); | ||||
|  | @ -877,8 +874,7 @@ void DerivationGoal::outputsSubstituted() | |||
|     foreach (DerivationInputs::iterator, i, drv.inputDrvs) | ||||
|         addWaitee(worker.makeDerivationGoal(i->first)); | ||||
| 
 | ||||
|     for (PathSet::iterator i = drv.inputSrcs.begin(); | ||||
|          i != drv.inputSrcs.end(); ++i) | ||||
|     foreach (PathSet::iterator, i, drv.inputSrcs) | ||||
|         addWaitee(worker.makeSubstitutionGoal(*i)); | ||||
| 
 | ||||
|     state = &DerivationGoal::inputsRealised; | ||||
|  | @ -949,8 +945,7 @@ void DerivationGoal::inputsRealised() | |||
| PathSet outputPaths(const DerivationOutputs & outputs) | ||||
| { | ||||
|     PathSet paths; | ||||
|     for (DerivationOutputs::const_iterator i = outputs.begin(); | ||||
|          i != outputs.end(); ++i) | ||||
|     foreach (DerivationOutputs::const_iterator, i, outputs) | ||||
|         paths.insert(i->second.path); | ||||
|     return paths; | ||||
| } | ||||
|  | @ -1313,17 +1308,14 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook() | |||
|         computeFSClosure(drvPath, allInputs); | ||||
|          | ||||
|         string s; | ||||
|         for (PathSet::iterator i = allInputs.begin(); | ||||
|              i != allInputs.end(); ++i) | ||||
|             s += *i + "\n"; | ||||
|         foreach (PathSet::iterator, i, allInputs) s += *i + "\n"; | ||||
|          | ||||
|         writeStringToFile(inputListFN, s); | ||||
| 
 | ||||
|         /* The `outputs' file lists all outputs that have to be copied
 | ||||
|            from the remote system. */ | ||||
|         s = ""; | ||||
|         for (DerivationOutputs::iterator i = drv.outputs.begin(); | ||||
|              i != drv.outputs.end(); ++i) | ||||
|         foreach (DerivationOutputs::iterator, i, drv.outputs) | ||||
|             s += i->second.path + "\n"; | ||||
|         writeStringToFile(outputListFN, s); | ||||
| 
 | ||||
|  | @ -1411,8 +1403,7 @@ void DerivationGoal::startBuilder() | |||
|     env["NIX_STORE"] = nixStore; | ||||
| 
 | ||||
|     /* Add all bindings specified in the derivation. */ | ||||
|     for (StringPairs::iterator i = drv.env.begin(); | ||||
|          i != drv.env.end(); ++i) | ||||
|     foreach (StringPairs::iterator, i, drv.env) | ||||
|         env[i->first] = i->second; | ||||
| 
 | ||||
|     /* Create a temporary directory where the build will take
 | ||||
|  | @ -1449,8 +1440,7 @@ void DerivationGoal::startBuilder() | |||
|        already know the cryptographic hash of the output). */ | ||||
|     if (fixedOutput) { | ||||
|         Strings varNames = tokenizeString(drv.env["impureEnvVars"]); | ||||
|         for (Strings::iterator i = varNames.begin(); i != varNames.end(); ++i) | ||||
|             env[*i] = getEnv(*i); | ||||
|         foreach (Strings::iterator, i, varNames) env[*i] = getEnv(*i); | ||||
|     } | ||||
| 
 | ||||
|     /* The `exportReferencesGraph' feature allows the references graph
 | ||||
|  | @ -1690,8 +1680,7 @@ void DerivationGoal::startBuilder() | |||
| 
 | ||||
|             /* Fill in the environment. */ | ||||
|             Strings envStrs; | ||||
|             for (Environment::const_iterator i = env.begin(); | ||||
|                  i != env.end(); ++i) | ||||
|             foreach (Environment::const_iterator, i, env) | ||||
|                 envStrs.push_back(i->first + "=" + i->second); | ||||
|             const char * * envArr = strings2CharPtrs(envStrs); | ||||
| 
 | ||||
|  | @ -1737,8 +1726,7 @@ void DerivationGoal::startBuilder() | |||
|             /* Fill in the arguments. */ | ||||
|             string builderBasename = baseNameOf(drv.builder); | ||||
|             args.push_back(builderBasename.c_str()); | ||||
|             for (Strings::iterator i = drv.args.begin(); | ||||
|                  i != drv.args.end(); ++i) | ||||
|             foreach (Strings::iterator, i, drv.args) | ||||
|                 args.push_back(i->c_str()); | ||||
|             args.push_back(0); | ||||
| 
 | ||||
|  | @ -1777,7 +1765,7 @@ PathSet parseReferenceSpecifiers(const Derivation & drv, string attr) | |||
| { | ||||
|     PathSet result; | ||||
|     Paths paths = tokenizeString(attr); | ||||
|     for (Strings::iterator i = paths.begin(); i != paths.end(); ++i) { | ||||
|     foreach (Strings::iterator, i, paths) { | ||||
|         if (isStorePath(*i)) | ||||
|             result.insert(*i); | ||||
|         else if (drv.outputs.find(*i) != drv.outputs.end()) | ||||
|  | @ -1886,7 +1874,7 @@ void DerivationGoal::computeClosure() | |||
|            allowedReferences should really be per-output. */ | ||||
|         if (drv.env.find("allowedReferences") != drv.env.end()) { | ||||
|             PathSet allowed = parseReferenceSpecifiers(drv, drv.env["allowedReferences"]); | ||||
|             for (PathSet::iterator i = references.begin(); i != references.end(); ++i) | ||||
|             foreach (PathSet::iterator, i, references) | ||||
|                 if (allowed.find(*i) == allowed.end()) | ||||
|                     throw BuildError(format("output is not allowed to refer to path `%1%'") % *i); | ||||
|         } | ||||
|  | @ -1990,8 +1978,7 @@ void DerivationGoal::handleEOF(int fd) | |||
| PathSet DerivationGoal::checkPathValidity(bool returnValid) | ||||
| { | ||||
|     PathSet result; | ||||
|     for (DerivationOutputs::iterator i = drv.outputs.begin(); | ||||
|          i != drv.outputs.end(); ++i) | ||||
|     foreach (DerivationOutputs::iterator, i, drv.outputs) | ||||
|         if (worker.store.isValidPath(i->second.path)) { | ||||
|             if (returnValid) result.insert(i->second.path); | ||||
|         } else { | ||||
|  | @ -2495,9 +2482,7 @@ void Worker::childTerminated(pid_t pid, bool wakeSleepers) | |||
|     if (wakeSleepers) { | ||||
|          | ||||
|         /* Wake up goals waiting for a build slot. */ | ||||
|         for (WeakGoals::iterator i = wantingToBuild.begin(); | ||||
|              i != wantingToBuild.end(); ++i) | ||||
|         { | ||||
|         foreach (WeakGoals::iterator, i, wantingToBuild) { | ||||
|             GoalPtr goal = i->lock(); | ||||
|             if (goal) wakeUp(goal); | ||||
|         } | ||||
|  | @ -2533,9 +2518,7 @@ void Worker::waitForAWhile(GoalPtr goal) | |||
| 
 | ||||
| void Worker::run(const Goals & _topGoals) | ||||
| { | ||||
|     for (Goals::iterator i = _topGoals.begin(); | ||||
|          i != _topGoals.end(); ++i) | ||||
|         topGoals.insert(*i); | ||||
|     foreach (Goals::iterator, i,  _topGoals) topGoals.insert(*i); | ||||
|      | ||||
|     startNest(nest, lvlDebug, format("entered goal loop")); | ||||
| 
 | ||||
|  | @ -2547,7 +2530,7 @@ void Worker::run(const Goals & _topGoals) | |||
|         while (!awake.empty() && !topGoals.empty()) { | ||||
|             WeakGoals awake2(awake); | ||||
|             awake.clear(); | ||||
|             for (WeakGoals::iterator i = awake2.begin(); i != awake2.end(); ++i) { | ||||
|             foreach (WeakGoals::iterator, i, awake2) { | ||||
|                 checkInterrupt(); | ||||
|                 GoalPtr goal = i->lock(); | ||||
|                 if (goal) goal->work(); | ||||
|  | @ -2709,14 +2692,13 @@ void LocalStore::buildDerivations(const PathSet & drvPaths) | |||
|     Worker worker(*this); | ||||
| 
 | ||||
|     Goals goals; | ||||
|     for (PathSet::const_iterator i = drvPaths.begin(); | ||||
|          i != drvPaths.end(); ++i) | ||||
|     foreach (PathSet::const_iterator, i, drvPaths) | ||||
|         goals.insert(worker.makeDerivationGoal(*i)); | ||||
| 
 | ||||
|     worker.run(goals); | ||||
| 
 | ||||
|     PathSet failed; | ||||
|     for (Goals::iterator i = goals.begin(); i != goals.end(); ++i) | ||||
|     foreach (Goals::iterator, i, goals) | ||||
|         if ((*i)->getExitCode() == Goal::ecFailed) { | ||||
|             DerivationGoal * i2 = dynamic_cast<DerivationGoal *>(i->get()); | ||||
|             assert(i2); | ||||
|  |  | |||
|  | @ -21,8 +21,7 @@ Path writeDerivation(const Derivation & drv, const string & name) | |||
| { | ||||
|     PathSet references; | ||||
|     references.insert(drv.inputSrcs.begin(), drv.inputSrcs.end()); | ||||
|     for (DerivationInputs::const_iterator i = drv.inputDrvs.begin(); | ||||
|          i != drv.inputDrvs.end(); ++i) | ||||
|     foreach (DerivationInputs::const_iterator, i, drv.inputDrvs) | ||||
|         references.insert(i->first); | ||||
|     /* Note that the outputs of a derivation are *not* references
 | ||||
|        (that can be missing (of course) and should not necessarily be | ||||
|  |  | |||
|  | @ -247,9 +247,7 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds) | |||
|     Strings tempRootFiles = readDirectory( | ||||
|         (format("%1%/%2%") % nixStateDir % tempRootsDir).str()); | ||||
| 
 | ||||
|     for (Strings::iterator i = tempRootFiles.begin(); | ||||
|          i != tempRootFiles.end(); ++i) | ||||
|     { | ||||
|     foreach (Strings::iterator, i, tempRootFiles) { | ||||
|         Path path = (format("%1%/%2%/%3%") % nixStateDir % tempRootsDir % *i).str(); | ||||
| 
 | ||||
|         debug(format("reading temporary root file `%1%'") % path); | ||||
|  | @ -328,7 +326,7 @@ static void findRoots(const Path & path, bool recurseSymlinks, | |||
| 
 | ||||
|         if (S_ISDIR(st.st_mode)) { | ||||
|             Strings names = readDirectory(path); | ||||
|             for (Strings::iterator i = names.begin(); i != names.end(); ++i) | ||||
|             foreach (Strings::iterator, i, names) | ||||
|                 findRoots(path + "/" + *i, recurseSymlinks, deleteStale, roots); | ||||
|         } | ||||
| 
 | ||||
|  | @ -399,7 +397,7 @@ static void addAdditionalRoots(PathSet & roots) | |||
| 
 | ||||
|     Strings paths = tokenizeString(result, "\n"); | ||||
|      | ||||
|     for (Strings::iterator i = paths.begin(); i != paths.end(); ++i) { | ||||
|     foreach (Strings::iterator, i, paths) { | ||||
|         if (isInStore(*i)) { | ||||
|             Path path = toStorePath(*i); | ||||
|             if (roots.find(path) == roots.end() && store->isValidPath(path)) { | ||||
|  | @ -421,8 +419,7 @@ static void dfsVisit(const PathSet & paths, const Path & path, | |||
|     if (store->isValidPath(path)) | ||||
|         store->queryReferences(path, references); | ||||
|      | ||||
|     for (PathSet::iterator i = references.begin(); | ||||
|          i != references.end(); ++i) | ||||
|     foreach (PathSet::iterator, i, references) | ||||
|         /* Don't traverse into paths that don't exist.  That can
 | ||||
|            happen due to substitutes for non-existent paths. */ | ||||
|         if (*i != path && paths.find(*i) != paths.end()) | ||||
|  | @ -436,7 +433,7 @@ Paths topoSortPaths(const PathSet & paths) | |||
| { | ||||
|     Paths sorted; | ||||
|     PathSet visited; | ||||
|     for (PathSet::const_iterator i = paths.begin(); i != paths.end(); ++i) | ||||
|     foreach (PathSet::const_iterator, i, paths) | ||||
|         dfsVisit(paths, *i, visited, sorted); | ||||
|     return sorted; | ||||
| } | ||||
|  | @ -453,7 +450,7 @@ static time_t lastFileAccessTime(const Path & path) | |||
|     if (S_ISDIR(st.st_mode)) { | ||||
|         time_t last = 0; | ||||
| 	Strings names = readDirectory(path); | ||||
| 	for (Strings::iterator i = names.begin(); i != names.end(); ++i) { | ||||
| 	foreach (Strings::iterator, i, names) { | ||||
|             time_t t = lastFileAccessTime(path + "/" + *i); | ||||
|             if (t > last) last = t; | ||||
|         } | ||||
|  | @ -594,8 +591,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) | |||
|     Roots rootMap = options.ignoreLiveness ? Roots() : nix::findRoots(true); | ||||
| 
 | ||||
|     PathSet roots; | ||||
|     for (Roots::iterator i = rootMap.begin(); i != rootMap.end(); ++i) | ||||
|         roots.insert(i->second); | ||||
|     foreach (Roots::iterator, i, rootMap) roots.insert(i->second); | ||||
| 
 | ||||
|     /* Add additional roots returned by the program specified by the
 | ||||
|        NIX_ROOT_FINDER environment variable.  This is typically used | ||||
|  | @ -613,13 +609,11 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) | |||
|        roots under the `references' relation. */ | ||||
|     printMsg(lvlError, format("computing live paths...")); | ||||
|     PathSet livePaths; | ||||
|     for (PathSet::const_iterator i = roots.begin(); i != roots.end(); ++i) | ||||
|     foreach (PathSet::const_iterator, i, roots) | ||||
|         computeFSClosure(canonPath(*i), livePaths); | ||||
| 
 | ||||
|     if (gcKeepDerivations) { | ||||
|         for (PathSet::iterator i = livePaths.begin(); | ||||
|              i != livePaths.end(); ++i) | ||||
|         { | ||||
|         foreach (PathSet::iterator, i, livePaths) { | ||||
|             /* Note that the deriver need not be valid (e.g., if we
 | ||||
|                previously ran the collector with `gcKeepDerivations' | ||||
|                turned off). */ | ||||
|  | @ -631,8 +625,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) | |||
| 
 | ||||
|     if (gcKeepOutputs) { | ||||
|         /* Hmz, identical to storePathRequisites in nix-store. */ | ||||
|         for (PathSet::iterator i = livePaths.begin(); | ||||
|              i != livePaths.end(); ++i) | ||||
|         foreach (PathSet::iterator, i, livePaths) | ||||
|             if (isDerivation(*i)) { | ||||
|                 Derivation drv = derivationFromPath(*i); | ||||
| 
 | ||||
|  | @ -642,8 +635,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) | |||
| 		    gcLevel = defaultGcLevel; | ||||
| 		 | ||||
| 		if (gcLevel >= gcKeepOutputsThreshold)     | ||||
| 		    for (DerivationOutputs::iterator j = drv.outputs.begin(); | ||||
|                          j != drv.outputs.end(); ++j) | ||||
| 		    foreach (DerivationOutputs::iterator, j, drv.outputs) | ||||
| 			if (isValidPath(j->second.path)) | ||||
| 			    computeFSClosure(j->second.path, livePaths); | ||||
|             } | ||||
|  | @ -668,7 +660,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) | |||
|        (and computeFSClosure() assumes that the presence of a path | ||||
|        means that it has already been closed). */ | ||||
|     PathSet tempRootsClosed; | ||||
|     for (PathSet::iterator i = tempRoots.begin(); i != tempRoots.end(); ++i) | ||||
|     foreach (PathSet::iterator, i, tempRoots) | ||||
|         if (isValidPath(*i)) | ||||
|             computeFSClosure(*i, tempRootsClosed); | ||||
|         else | ||||
|  |  | |||
|  | @ -162,7 +162,7 @@ void canonicalisePathMetaData(const Path & path, bool recurse) | |||
| 
 | ||||
|     if (recurse && S_ISDIR(st.st_mode)) { | ||||
|         Strings names = readDirectory(path); | ||||
| 	for (Strings::iterator i = names.begin(); i != names.end(); ++i) | ||||
| 	foreach (Strings::iterator, i, names) | ||||
| 	    canonicalisePathMetaData(path + "/" + *i, true); | ||||
|     } | ||||
| } | ||||
|  | @ -392,7 +392,7 @@ ValidPathInfo LocalStore::queryPathInfo(const Path & path, bool ignoreErrors) | |||
|     /* Parse it. */ | ||||
|     Strings lines = tokenizeString(info, "\n"); | ||||
| 
 | ||||
|     for (Strings::iterator i = lines.begin(); i != lines.end(); ++i) { | ||||
|     foreach (Strings::iterator, i, lines) { | ||||
|         string::size_type p = i->find(':'); | ||||
|         if (p == string::npos) continue; /* bad line */ | ||||
|         string name(*i, 0, p); | ||||
|  | @ -433,7 +433,7 @@ PathSet LocalStore::queryValidPaths() | |||
| { | ||||
|     PathSet paths; | ||||
|     Strings entries = readDirectory(nixDBPath + "/info"); | ||||
|     for (Strings::iterator i = entries.begin(); i != entries.end(); ++i) | ||||
|     foreach (Strings::iterator, i, entries) | ||||
|         if (i->at(0) != '.') paths.insert(nixStore + "/" + *i); | ||||
|     return paths; | ||||
| } | ||||
|  | @ -468,7 +468,7 @@ bool LocalStore::queryReferrersInternal(const Path & path, PathSet & referrers) | |||
| 
 | ||||
|     Paths refs = tokenizeString(readFile(fd), " "); | ||||
| 
 | ||||
|     for (Paths::iterator i = refs.begin(); i != refs.end(); ++i) | ||||
|     foreach (Paths::iterator, i, refs) | ||||
|         /* Referrers can be invalid (see registerValidPath() for the
 | ||||
|            invariant), so we only return one if it is valid. */ | ||||
|         if (isStorePath(*i) && isValidPath(*i)) referrers.insert(*i); else allValid = false; | ||||
|  | @ -600,8 +600,7 @@ static void dfsVisit(std::map<Path, ValidPathInfo> & infos, | |||
| 
 | ||||
|     ValidPathInfo & info(infos[path]); | ||||
|      | ||||
|     for (PathSet::iterator i = info.references.begin(); | ||||
|          i != info.references.end(); ++i) | ||||
|     foreach (PathSet::iterator, i, info.references) | ||||
|         if (infos.find(*i) != infos.end()) | ||||
|             dfsVisit(infos, *i, visited, sorted); | ||||
| 
 | ||||
|  | @ -616,15 +615,15 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos) | |||
|     /* Sort the paths topologically under the references relation, so
 | ||||
|        that if path A is referenced by B, then A is registered before | ||||
|        B. */ | ||||
|     for (ValidPathInfos::const_iterator i = infos.begin(); i != infos.end(); ++i) | ||||
|     foreach (ValidPathInfos::const_iterator, i, infos) | ||||
|         infosMap[i->path] = *i; | ||||
| 
 | ||||
|     PathSet visited; | ||||
|     Paths sorted; | ||||
|     for (ValidPathInfos::const_iterator i = infos.begin(); i != infos.end(); ++i) | ||||
|     foreach (ValidPathInfos::const_iterator, i, infos) | ||||
|         dfsVisit(infosMap, i->path, visited, sorted); | ||||
| 
 | ||||
|     for (Paths::iterator i = sorted.begin(); i != sorted.end(); ++i) | ||||
|     foreach (Paths::iterator, i, sorted) | ||||
|         registerValidPath(infosMap[*i]); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -30,16 +30,14 @@ void computeFSClosure(const Path & storePath, | |||
|     else | ||||
|         store->queryReferences(storePath, references); | ||||
| 
 | ||||
|     for (PathSet::iterator i = references.begin(); | ||||
|          i != references.end(); ++i) | ||||
|     foreach (PathSet::iterator, i, references) | ||||
|         computeFSClosure(*i, paths, flipDirection); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| Path findOutput(const Derivation & drv, string id) | ||||
| { | ||||
|     for (DerivationOutputs::const_iterator i = drv.outputs.begin(); | ||||
|          i != drv.outputs.end(); ++i) | ||||
|     foreach (DerivationOutputs::const_iterator, i, drv.outputs) | ||||
|         if (i->first == id) return i->second.path; | ||||
|     throw Error(format("derivation has no output `%1%'") % id); | ||||
| } | ||||
|  | @ -67,20 +65,17 @@ void queryMissing(const PathSet & targets, | |||
|             Derivation drv = derivationFromPath(p); | ||||
| 
 | ||||
|             bool mustBuild = false; | ||||
|             for (DerivationOutputs::iterator i = drv.outputs.begin(); | ||||
|                  i != drv.outputs.end(); ++i) | ||||
|             foreach (DerivationOutputs::iterator, i, drv.outputs) | ||||
|                 if (!store->isValidPath(i->second.path) && !store->hasSubstitutes(i->second.path)) | ||||
|                     mustBuild = true; | ||||
| 
 | ||||
|             if (mustBuild) { | ||||
|                 willBuild.insert(p); | ||||
|                 todo.insert(drv.inputSrcs.begin(), drv.inputSrcs.end()); | ||||
|                 for (DerivationInputs::iterator i = drv.inputDrvs.begin(); | ||||
|                      i != drv.inputDrvs.end(); ++i) | ||||
|                 foreach (DerivationInputs::iterator, i, drv.inputDrvs) | ||||
|                     todo.insert(i->first); | ||||
|             } else  | ||||
|                 for (DerivationOutputs::iterator i = drv.outputs.begin(); | ||||
|                      i != drv.outputs.end(); ++i) | ||||
|                 foreach (DerivationOutputs::iterator, i, drv.outputs) | ||||
|                     todo.insert(i->second.path); | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -131,7 +131,7 @@ static void hashAndLink(bool dryRun, HashToPath & hashToPath, | |||
| 
 | ||||
|     if (S_ISDIR(st.st_mode)) { | ||||
|         Strings names = readDirectory(path); | ||||
| 	for (Strings::iterator i = names.begin(); i != names.end(); ++i) | ||||
| 	foreach (Strings::iterator, i, names) | ||||
| 	    hashAndLink(dryRun, hashToPath, stats, path + "/" + *i); | ||||
|     } | ||||
| } | ||||
|  | @ -143,7 +143,7 @@ void LocalStore::optimiseStore(bool dryRun, OptimiseStats & stats) | |||
| 
 | ||||
|     PathSet paths = queryValidPaths(); | ||||
| 
 | ||||
|     for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) { | ||||
|     foreach (PathSet::iterator, i, paths) { | ||||
|         addTempRoot(*i); | ||||
|         if (!isValidPath(*i)) continue; /* path was GC'ed, probably */ | ||||
|         startNest(nest, lvlChatty, format("hashing files in `%1%'") % *i); | ||||
|  |  | |||
|  | @ -155,7 +155,7 @@ bool PathLocks::lockPaths(const PathSet & _paths, | |||
|     paths.sort(); | ||||
|      | ||||
|     /* Acquire the lock for each path. */ | ||||
|     for (Paths::iterator i = paths.begin(); i != paths.end(); i++) { | ||||
|     foreach (Paths::iterator, i, paths) { | ||||
|         checkInterrupt(); | ||||
|         Path path = *i; | ||||
|         Path lockPath = path + ".lock"; | ||||
|  | @ -219,7 +219,7 @@ PathLocks::~PathLocks() | |||
| 
 | ||||
| void PathLocks::unlock() | ||||
| { | ||||
|     for (list<FDPair>::iterator i = fds.begin(); i != fds.end(); i++) { | ||||
|     foreach (list<FDPair>::iterator, i, fds) { | ||||
|         if (deletePaths) deleteLockFilePreClose(i->second, i->first); | ||||
| 
 | ||||
|         lockedPaths.erase(i->second); | ||||
|  |  | |||
|  | @ -29,8 +29,7 @@ Path readStorePath(Source & from) | |||
| PathSet readStorePaths(Source & from) | ||||
| { | ||||
|     PathSet paths = readStringSet(from); | ||||
|     for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) | ||||
|         assertStorePath(*i); | ||||
|     foreach (PathSet::iterator, i, paths) assertStorePath(*i); | ||||
|     return paths; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ void checkStoreName(const string & name) | |||
|        reasons (e.g., "." and ".."). */ | ||||
|     if (string(name, 0, 1) == ".") | ||||
|         throw Error(format("illegal name: `%1%'") % name); | ||||
|     for (string::const_iterator i = name.begin(); i != name.end(); ++i) | ||||
|     foreach (string::const_iterator, i, name) | ||||
|         if (!((*i >= 'A' && *i <= 'Z') || | ||||
|               (*i >= 'a' && *i <= 'z') || | ||||
|               (*i >= '0' && *i <= '9') || | ||||
|  | @ -207,7 +207,7 @@ Path computeStorePathForText(const string & name, const string & s, | |||
|        hacky, but we can't put them in `s' since that would be | ||||
|        ambiguous. */ | ||||
|     string type = "text"; | ||||
|     for (PathSet::const_iterator i = references.begin(); i != references.end(); ++i) { | ||||
|     foreach (PathSet::const_iterator, i, references) { | ||||
|         type += ":"; | ||||
|         type += *i; | ||||
|     } | ||||
|  | @ -223,7 +223,7 @@ string makeValidityRegistration(const PathSet & paths, | |||
| { | ||||
|     string s = ""; | ||||
|      | ||||
|     for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) { | ||||
|     foreach (PathSet::iterator, i, paths) { | ||||
|         s += *i + "\n"; | ||||
| 
 | ||||
|         if (showHash) | ||||
|  | @ -237,8 +237,7 @@ string makeValidityRegistration(const PathSet & paths, | |||
| 
 | ||||
|         s += (format("%1%\n") % references.size()).str(); | ||||
|              | ||||
|         for (PathSet::iterator j = references.begin(); | ||||
|              j != references.end(); ++j) | ||||
|         foreach (PathSet::iterator, j, references) | ||||
|             s += *j + "\n"; | ||||
|     } | ||||
| 
 | ||||
|  | @ -272,9 +271,7 @@ ValidPathInfo decodeValidPathInfo(std::istream & str, bool hashGiven) | |||
| string showPaths(const PathSet & paths) | ||||
| { | ||||
|     string s; | ||||
|     for (PathSet::const_iterator i = paths.begin(); | ||||
|          i != paths.end(); ++i) | ||||
|     { | ||||
|     foreach (PathSet::const_iterator, i, paths) { | ||||
|         if (s.size() != 0) s += ", "; | ||||
|         s += "`" + *i + "'"; | ||||
|     } | ||||
|  |  | |||
|  | @ -73,7 +73,7 @@ void LocalStore::upgradeStore12() | |||
|     Paths paths; | ||||
|     nixDB.enumTable(noTxn, dbValidPaths, paths); | ||||
|      | ||||
|     for (Paths::iterator i = paths.begin(); i != paths.end(); ++i) { | ||||
|     foreach (Paths::iterator, i, paths) { | ||||
|         ValidPathInfo info; | ||||
|         info.path = *i; | ||||
|          | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue