Module: check_mk
Branch: master
Commit: 1aafc71d5b9d765c4137755f22d6d64c3dde2217
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1aafc71d5b9d76…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Nov 10 08:30:48 2015 +0100
cppcheck-induced cleanup: Reduce scopes.
---
livestatus/src/DownCommColumn.cc | 3 +--
livestatus/src/ServiceSpecialDoubleColumn.cc | 3 +--
livestatus/src/TableHosts.cc | 3 +--
livestatus/src/TableServices.cc | 3 +--
livestatus/src/TableStateHistory.cc | 3 +--
5 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/livestatus/src/DownCommColumn.cc b/livestatus/src/DownCommColumn.cc
index 7a88e54..96b4e96 100644
--- a/livestatus/src/DownCommColumn.cc
+++ b/livestatus/src/DownCommColumn.cc
@@ -45,7 +45,6 @@ void DownCommColumn::output(void *data, Query *query)
if (data)
{
bool first = true;
- bool found_match = false;
for (map<pair<unsigned long, bool>, DowntimeOrComment *>::iterator it
= table->entriesIteratorBegin();
it != table->entriesIteratorEnd();
@@ -55,7 +54,7 @@ void DownCommColumn::output(void *data, Query *query)
bool is_service = it->first.second;
DowntimeOrComment *dt = it->second;
- found_match = false;
+ bool found_match = false;
if (!is_service){
if (dt->_host->name == ((host*)data)->name)
diff --git a/livestatus/src/ServiceSpecialDoubleColumn.cc
b/livestatus/src/ServiceSpecialDoubleColumn.cc
index 7e88a06..6e9c1b1 100644
--- a/livestatus/src/ServiceSpecialDoubleColumn.cc
+++ b/livestatus/src/ServiceSpecialDoubleColumn.cc
@@ -47,10 +47,9 @@ double ServiceSpecialDoubleColumn::getValue(void *data)
bool is_cmk_passive = !strncmp(svc->check_command_ptr->name,
"check_mk-", 9);
if (is_cmk_passive) {
host *host = svc->host_ptr;
- service *tmp_svc;
servicesmember *svc_member = host->services;
while (svc_member != 0) {
- tmp_svc = svc_member->service_ptr;
+ service *tmp_svc = svc_member->service_ptr;
if (!strncmp(tmp_svc->check_command_ptr->name,
"check-mk", 9)) {
return check_result_age / ((tmp_svc->check_interval == 0 ? 1 :
tmp_svc->check_interval) * interval_length);
}
diff --git a/livestatus/src/TableHosts.cc b/livestatus/src/TableHosts.cc
index 71cccfb..af4734f 100644
--- a/livestatus/src/TableHosts.cc
+++ b/livestatus/src/TableHosts.cc
@@ -375,14 +375,13 @@ void TableHosts::answerQuery(Query *query)
if (_by_group) {
hostgroup *hgroup = hostgroup_list;
hostbygroup hg;
- bool show_hgroup;
// When g_group_authorization is set to AUTH_STRICT we need to pre-check
// if every host of this group is visible to the _auth_user
bool requires_precheck = query->authUser() && g_group_authorization ==
AUTH_STRICT;
while (hgroup) {
- show_hgroup = true;
+ bool show_hgroup = true;
hg._hostgroup = hgroup;
hostsmember *mem = hgroup->members;
if (requires_precheck) {
diff --git a/livestatus/src/TableServices.cc b/livestatus/src/TableServices.cc
index 5049949..9b0f2dd 100644
--- a/livestatus/src/TableServices.cc
+++ b/livestatus/src/TableServices.cc
@@ -71,14 +71,13 @@ void TableServices::answerQuery(Query *query)
if (_by_group) {
servicegroup *sgroup = servicegroup_list;
servicebygroup sg;
- bool show_sgroup;
// When g_group_authorization is set to AUTH_STRICT we need to pre-check
// if every service of this group is visible to the _auth_user
bool requires_precheck = query->authUser() && g_group_authorization ==
AUTH_STRICT;
while (sgroup) {
- show_sgroup = true;
+ bool show_sgroup = true;
sg._servicegroup = sgroup;
servicesmember *mem = sgroup->members;
if (requires_precheck) {
diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc
index 68d139f..63c1227 100644
--- a/livestatus/src/TableStateHistory.cc
+++ b/livestatus/src/TableStateHistory.cc
@@ -335,7 +335,6 @@ void TableStateHistory::answerQuery(Query *query)
_it_entries = _entries->begin();
// From now on use getPreviousLogentry() / getNextLogentry()
- HostServiceKey key;
bool only_update = true;
bool in_nagios_initial_states = false;
@@ -374,7 +373,7 @@ void TableStateHistory::answerQuery(Query *query)
in_nagios_initial_states = false;
}
- key = 0;
+ HostServiceKey key = 0;
bool is_service = false;
switch (entry->_type) {
case NONE: