|
32 | 32 | #include "settings.h" |
33 | 33 | #include "suppressions.h" |
34 | 34 | #include "timer.h" |
| 35 | +#include "utils.h" |
35 | 36 |
|
36 | 37 | #include <algorithm> |
37 | 38 | #include <numeric> |
@@ -246,8 +247,8 @@ unsigned int ProcessExecutor::check() |
246 | 247 | std::map<pid_t, std::string> childFile; |
247 | 248 | std::map<int, std::string> pipeFile; |
248 | 249 | std::size_t processedsize = 0; |
249 | | - std::list<FileWithDetails>::const_iterator iFile = mFiles.cbegin(); |
250 | | - std::list<FileSettings>::const_iterator iFileSettings = mFileSettings.cbegin(); |
| 250 | + auto iFile = mFiles.cbegin(); |
| 251 | + auto iFileSettings = mFileSettings.cbegin(); |
251 | 252 | for (;;) { |
252 | 253 | // Start a new child |
253 | 254 | const size_t nchildren = childFile.size(); |
@@ -314,19 +315,19 @@ unsigned int ProcessExecutor::check() |
314 | 315 | if (!rpipes.empty()) { |
315 | 316 | fd_set rfds; |
316 | 317 | FD_ZERO(&rfds); |
317 | | - for (std::list<int>::const_iterator rp = rpipes.cbegin(); rp != rpipes.cend(); ++rp) |
| 318 | + for (auto rp = rpipes.cbegin(); rp != rpipes.cend(); ++rp) |
318 | 319 | FD_SET(*rp, &rfds); |
319 | 320 | timeval tv; // for every second polling of load average condition |
320 | 321 | tv.tv_sec = 1; |
321 | 322 | tv.tv_usec = 0; |
322 | 323 | const int r = select(*std::max_element(rpipes.cbegin(), rpipes.cend()) + 1, &rfds, nullptr, nullptr, &tv); |
323 | 324 |
|
324 | 325 | if (r > 0) { |
325 | | - std::list<int>::const_iterator rp = rpipes.cbegin(); |
| 326 | + auto rp = rpipes.cbegin(); |
326 | 327 | while (rp != rpipes.cend()) { |
327 | 328 | if (FD_ISSET(*rp, &rfds)) { |
328 | 329 | std::string name; |
329 | | - const std::map<int, std::string>::const_iterator p = pipeFile.find(*rp); |
| 330 | + const auto p = utils::as_const(pipeFile).find(*rp); |
330 | 331 | if (p != pipeFile.cend()) { |
331 | 332 | name = p->second; |
332 | 333 | } |
@@ -362,7 +363,7 @@ unsigned int ProcessExecutor::check() |
362 | 363 | const pid_t child = waitpid(0, &stat, WNOHANG); |
363 | 364 | if (child > 0) { |
364 | 365 | std::string childname; |
365 | | - const std::map<pid_t, std::string>::const_iterator c = childFile.find(child); |
| 366 | + const auto c = utils::as_const(childFile).find(child); |
366 | 367 | if (c != childFile.cend()) { |
367 | 368 | childname = c->second; |
368 | 369 | childFile.erase(c); |
|
0 commit comments