void LastOpenedSection::write(ostream & os) const
{
os << '\n' << sec_lastopened << '\n';
- for (size_t i = 0; i < lastopened.size(); ++i)
- os << lastopened[i].active << ", " << lastopened[i].file_name << '\n';
+ for (auto const & last : lastopened)
+ os << last.active << ", " << last.file_name << '\n';
}
// currently, we even crash in some cases (see #9483).
// FIXME: Add session support for multiple views of
// the same buffer (split-view etc.).
- for (size_t i = 0; i < lastopened.size(); ++i) {
- if (lastopened[i].file_name == file)
+ for (auto const & last : lastopened) {
+ if (last.file_name == file)
return;
}
lastopened.push_back(lof);
{
// Remove element if it was already present. Iterating should
// not be a problem since the list is small (<100 elements).
- for (FilePosList::const_iterator it = lastfilepos.begin();
+ for (FilePosList::iterator it = lastfilepos.begin();
it != lastfilepos.end(); ++it)
if (it->file == pos.file) {
lastfilepos.erase(it);
LastFilePosSection::FilePos LastFilePosSection::load(FileName const & fname) const
{
- for (auto & fp : lastfilepos)
+ for (auto const & fp : lastfilepos)
if (fp.file == fname)
// Has position information, return it.
return fp;
}
-void LastCommandsSection::add(std::string const & string)
+void LastCommandsSection::add(std::string const & command)
{
- lastcommands.push_back(string);
+ lastcommands.push_back(command);
}
bool AuthFilesSection::find(string const & name) const
{
- if (auth_files_.find(name) != auth_files_.end())
- return true;
-
- return false;
+ return auth_files_.find(name) != auth_files_.end();
}
bool ShellEscapeSection::findAuth(string const & name) const
{
- if (shellescape_files_.find(name + ",1") != shellescape_files_.end())
- return true;
-
- return false;
+ return shellescape_files_.find(name + ",1") != shellescape_files_.end();
}