Module: check_mk
Branch: master
Commit: 17679e821a0a26f021fe6ce1d447e83d266101ae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=17679e821a0a26…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Aug 19 09:19:57 2016 +0200
Fetched livestatus from downstream plus associated fixes.
---
livestatus/src/LogCache.cc | 4 +---
livestatus/src/Query.cc | 2 +-
livestatus/src/TableStateHistory.cc | 3 +--
livestatus/src/TimeperiodsCache.cc | 5 ++---
livestatus/src/VariadicFilter.cc | 2 +-
5 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/livestatus/src/LogCache.cc b/livestatus/src/LogCache.cc
index ec0090a..55d5592 100644
--- a/livestatus/src/LogCache.cc
+++ b/livestatus/src/LogCache.cc
@@ -43,8 +43,6 @@ using std::chrono::system_clock;
extern time_t last_log_rotation;
#endif // CMC
-using std::make_pair;
-
#define CHECK_MEM_CYCLE 1000 /* Check memory every N'th new message */
// watch nagios' logfile rotation
@@ -166,7 +164,7 @@ void LogCache::scanLogfile(char *path, bool watch) {
// under normal circumstances this never happens. But the
// user might have copied files around.
if (_logfiles.find(since) == _logfiles.end()) {
- _logfiles.insert(make_pair(since, logfile));
+ _logfiles.emplace(since, logfile);
} else {
logger(LG_WARN, "Ignoring duplicate logfile %s", path);
delete logfile;
diff --git a/livestatus/src/Query.cc b/livestatus/src/Query.cc
index 13513fe..32d1f2e 100644
--- a/livestatus/src/Query.cc
+++ b/livestatus/src/Query.cc
@@ -877,7 +877,7 @@ Aggregator **Query::getStatsGroup(Query::_stats_group_spec_t
&groupspec) {
for (unsigned i = 0; i < _stats_columns.size(); i++) {
aggr[i] = _stats_columns[i]->createAggregator();
}
- _stats_groups.insert(make_pair(groupspec, aggr));
+ _stats_groups.emplace(groupspec, aggr);
return aggr;
}
return it->second;
diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc
index 82dbb98..c980afa 100644
--- a/livestatus/src/TableStateHistory.cc
+++ b/livestatus/src/TableStateHistory.cc
@@ -64,7 +64,6 @@ class VariadicFilter;
using mk::starts_with;
using std::deque;
using std::lock_guard;
-using std::make_pair;
using std::map;
using std::mutex;
using std::set;
@@ -559,7 +558,7 @@ void TableStateHistory::answerQuery(Query *query) {
}
// Store this state object for tracking state transitions
- state_info.insert(make_pair(key, state));
+ state_info.emplace(key, state);
state->_from = _since;
// Get notification period of host/service
diff --git a/livestatus/src/TimeperiodsCache.cc b/livestatus/src/TimeperiodsCache.cc
index 48492c3..3880701 100644
--- a/livestatus/src/TimeperiodsCache.cc
+++ b/livestatus/src/TimeperiodsCache.cc
@@ -31,7 +31,6 @@
#include "logger.h"
using std::lock_guard;
-using std::make_pair;
using std::mutex;
extern timeperiod *timeperiod_list;
@@ -54,7 +53,7 @@ void TimeperiodsCache::logCurrentTimeperiods() {
auto it = _cache.find(tp);
if (it == _cache.end()) { // first entry
logTransition(tp->name, -1, is_in ? 1 : 0);
- _cache.insert(make_pair(tp, is_in));
+ _cache.emplace(tp, is_in);
}
logTransition(tp->name, it->second ? 1 : 0, is_in ? 1 : 0);
}
@@ -84,7 +83,7 @@ void TimeperiodsCache::update(time_t now) {
auto it = _cache.find(tp);
if (it == _cache.end()) { // first entry
logTransition(tp->name, -1, is_in ? 1 : 0);
- _cache.insert(make_pair(tp, is_in));
+ _cache.emplace(tp, is_in);
} else if (it->second != is_in) {
logTransition(tp->name, it->second ? 1 : 0, is_in ? 1 : 0);
it->second = is_in;
diff --git a/livestatus/src/VariadicFilter.cc b/livestatus/src/VariadicFilter.cc
index 3aa29f0..8adc5ef 100644
--- a/livestatus/src/VariadicFilter.cc
+++ b/livestatus/src/VariadicFilter.cc
@@ -81,7 +81,7 @@ void VariadicFilter::combineFilters(int count, LogicalOperator andor) {
}
auto variadic = VariadicFilter::make(andor);
- while (count-- != 0) {
+ for (auto i = 0; i < count; ++i) {
variadic->addSubfilter(_subfilters.back());
_subfilters.pop_back();
}