From 6bd2c7bb386de16310fa5534275e6e638be60862 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Jul 2015 19:24:28 +0200 Subject: OCD: foreach -> C++11 ranged for --- src/libstore/globals.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libstore/globals.cc') diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 50374f782dee..73f8489438fc 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -248,12 +248,12 @@ template 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(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)); } } -- cgit 1.4.1