summaryrefslogtreecommitdiff
path: root/src/ServerStatMan.cc
diff options
context:
space:
mode:
authorNils Maier <maierman@web.de>2013-08-25 18:00:46 +0200
committerNils Maier <maierman@web.de>2013-09-20 23:06:49 +0200
commit3590077d5c43d492b3e357d1a50afca4a7d1cfcf (patch)
tree592516aa08b74c7e90c41a9b50c227f3f5b877b0 /src/ServerStatMan.cc
parenta76eeb2b8106dd725097750c3ee4958e505e3c85 (diff)
More auto-converts by cpp11-migrate
Diffstat (limited to 'src/ServerStatMan.cc')
-rw-r--r--src/ServerStatMan.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/ServerStatMan.cc b/src/ServerStatMan.cc
index d748ab51..2d250670 100644
--- a/src/ServerStatMan.cc
+++ b/src/ServerStatMan.cc
@@ -60,7 +60,7 @@ std::shared_ptr<ServerStat> ServerStatMan::find(const std::string& hostname,
const std::string& protocol) const
{
std::shared_ptr<ServerStat> ss(new ServerStat(hostname, protocol));
- ServerStatSet::iterator i = serverStats_.find(ss);
+ auto i = serverStats_.find(ss);
if(i == serverStats_.end()) {
return nullptr;
} else {
@@ -70,7 +70,7 @@ std::shared_ptr<ServerStat> ServerStatMan::find(const std::string& hostname,
bool ServerStatMan::add(const std::shared_ptr<ServerStat>& serverStat)
{
- ServerStatSet::iterator i = serverStats_.lower_bound(serverStat);
+ auto i = serverStats_.lower_bound(serverStat);
if(i != serverStats_.end() && *(*i) == *serverStat) {
return false;
} else {
@@ -90,9 +90,8 @@ bool ServerStatMan::save(const std::string& filename) const
filename.c_str()));
return false;
}
- for(ServerStatSet::iterator i = serverStats_.begin(),
- eoi = serverStats_.end(); i != eoi; ++i) {
- std::string l = (*i)->toString();
+ for(auto& e: serverStats_) {
+ std::string l = e->toString();
l += "\n";
if(fp.write(l.data(), l.size()) != l.size()) {
A2_LOG_ERROR(fmt(MSG_WRITING_SERVER_STAT_FILE_FAILED,
@@ -252,8 +251,7 @@ public:
void ServerStatMan::removeStaleServerStat(time_t timeout)
{
FindStaleServerStat finder(timeout);
- for(ServerStatSet::iterator i = serverStats_.begin(),
- eoi = serverStats_.end(); i != eoi;) {
+ for(auto i = serverStats_.begin(), eoi = serverStats_.end(); i != eoi;) {
if(finder(*i)) {
serverStats_.erase(i++);
} else {