mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
OCD: foreach -> C++11 ranged for
This commit is contained in:
parent
1511aa9f48
commit
6bd2c7bb38
30 changed files with 849 additions and 874 deletions
|
@ -248,12 +248,12 @@ template<class N> void Settings::_get(N & res, const string & name)
|
|||
string Settings::pack()
|
||||
{
|
||||
string s;
|
||||
foreach (SettingsMap::iterator, i, settings) {
|
||||
if (i->first.find('\n') != string::npos ||
|
||||
i->first.find('=') != string::npos ||
|
||||
i->second.find('\n') != string::npos)
|
||||
for (auto & i : settings) {
|
||||
if (i.first.find('\n') != string::npos ||
|
||||
i.first.find('=') != string::npos ||
|
||||
i.second.find('\n') != string::npos)
|
||||
throw Error("illegal option name/value");
|
||||
s += i->first; s += '='; s += i->second; s += '\n';
|
||||
s += i.first; s += '='; s += i.second; s += '\n';
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -261,11 +261,11 @@ string Settings::pack()
|
|||
|
||||
void Settings::unpack(const string & pack) {
|
||||
Strings lines = tokenizeString<Strings>(pack, "\n");
|
||||
foreach (Strings::iterator, i, lines) {
|
||||
string::size_type eq = i->find('=');
|
||||
for (auto & i : lines) {
|
||||
string::size_type eq = i.find('=');
|
||||
if (eq == string::npos)
|
||||
throw Error("illegal option name/value");
|
||||
set(i->substr(0, eq), i->substr(eq + 1));
|
||||
set(i.substr(0, eq), i.substr(eq + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue