Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranged for #73

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions storage/AppUtil.cc
Expand Up @@ -267,16 +267,16 @@ map<string,string>
makeMap( const list<string>& l, const string& delim, const string& removeSur )
{
map<string,string> ret;
for( list<string>::const_iterator i=l.begin(); i!=l.end(); ++i )
for (auto const &i : l)
{
string k, v;
string::size_type pos;
if( (pos=i->find_first_of( delim ))!=string::npos )
if ((pos = i.find_first_of(delim)) != string::npos)
{
k = i->substr( 0, pos );
string::size_type pos2 = i->find_first_not_of( delim, pos+1 );
if( pos2 != string::npos )
v = i->substr( pos2 );
k = i.substr(0, pos);
string::size_type pos2 = i.find_first_not_of(delim, pos + 1);
if (pos2 != string::npos)
v = i.substr(pos2);
}
if( !removeSur.empty() )
{
Expand Down Expand Up @@ -307,8 +307,8 @@ makeMap( const list<string>& l, const string& delim, const string& removeSur )
list<string> normalizeDevices(const list<string>& devs)
{
list<string> ret;
for (list<string>::const_iterator it = devs.begin(); it != devs.end(); ++it)
ret.push_back(normalizeDevice(*it));
for (auto const &s : devs)
ret.push_back(normalizeDevice(s));
return ret;
}

Expand Down Expand Up @@ -733,11 +733,11 @@ getMajorDevices(const char* driver)
}

LogLevel level = instsys ? storage::ERROR : storage::MILESTONE;
for (set<string>::const_iterator it = paths.begin(); it != paths.end(); ++it)
for (auto const &s : paths)
{
if (access(it->c_str(), X_OK) != 0)
if (access(s.c_str(), X_OK) != 0)
y2log_op(level, __FILE__, __LINE__, __FUNCTION__,
"error accessing " << *it);
"error accessing " << s);
}
}

Expand Down
17 changes: 8 additions & 9 deletions storage/AsciiFile.cc
Expand Up @@ -103,8 +103,8 @@ AsciiFile::save()
ofstream file( Name_C.c_str() );
classic(file);

for (vector<string>::const_iterator it = Lines_C.begin(); it != Lines_C.end(); ++it)
file << *it << std::endl;
for (auto const &s : Lines_C)
file << s << std::endl;

file.close();

Expand All @@ -117,8 +117,8 @@ AsciiFile::save()
AsciiFile::logContent() const
{
y2mil("content of " << (Name_C.empty() ? "<nameless>" : Name_C));
for (vector<string>::const_iterator it = Lines_C.begin(); it != Lines_C.end(); ++it)
y2mil(*it);
for (auto const &s : Lines_C)
y2mil(s);
}


Expand All @@ -138,8 +138,8 @@ void AsciiFile::append( const string& Line_Cv )

void AsciiFile::append( const vector<string>& lines )
{
for( vector<string>::const_iterator i=lines.begin(); i!=lines.end(); ++i )
append( *i );
for (auto const &s: lines)
append(s);
}

void AsciiFile::replace( unsigned int Start_iv, unsigned int Cnt_iv,
Expand All @@ -153,9 +153,8 @@ void AsciiFile::replace( unsigned int Start_iv, unsigned int Cnt_iv,
const vector<string>& lines )
{
remove( Start_iv, Cnt_iv );
for( vector<string>::const_reverse_iterator i=lines.rbegin(); i!=lines.rend();
++i )
insert( Start_iv, *i );
for (auto const &i : make_range(lines.rbegin(), lines.rend()))
insert(Start_iv, i);
}


Expand Down