Module: check_mk
Branch: master
Commit: 36943f30aa5c344ff89ddbf06fbf59ba215bce9b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=36943f30aa5c34…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Dec 18 11:09:21 2017 +0100
Consistently use Object::isCurrentStateOK.
Change-Id: I7c0a70ffde7a7c4e5bda0c53a220c994444507a6
---
livestatus/src/HostSpecialIntColumn.cc | 11 +++++------
livestatus/src/ServiceSpecialIntColumn.cc | 11 +++++------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/livestatus/src/HostSpecialIntColumn.cc
b/livestatus/src/HostSpecialIntColumn.cc
index 127aa1e..b23321b 100644
--- a/livestatus/src/HostSpecialIntColumn.cc
+++ b/livestatus/src/HostSpecialIntColumn.cc
@@ -46,14 +46,13 @@ int32_t HostSpecialIntColumn::getValue(Row row,
if (auto object = columnData<Object>(row)) {
switch (_type) {
case Type::real_hard_state: {
- auto state = object->state();
- if (state->_current_state == 0) {
+ if (object->isCurrentStateOK()) {
return 0;
}
- if (state->_state_type == StateType::hard) {
- return state->_current_state;
- }
- return state->_last_hard_state;
+ auto state = object->state();
+ return state->_state_type == StateType::hard
+ ? state->_current_state
+ : state->_last_hard_state;
}
case Type::pnp_graph_present:
return _mc->impl<Core>()
diff --git a/livestatus/src/ServiceSpecialIntColumn.cc
b/livestatus/src/ServiceSpecialIntColumn.cc
index 0b92005..cf043a5 100644
--- a/livestatus/src/ServiceSpecialIntColumn.cc
+++ b/livestatus/src/ServiceSpecialIntColumn.cc
@@ -44,14 +44,13 @@ int32_t ServiceSpecialIntColumn::getValue(
if (auto object = columnData<Object>(row)) {
switch (_type) {
case Type::real_hard_state: {
- auto state = object->state();
- if (state->_current_state == 0) {
+ if (object->isCurrentStateOK()) {
return 0;
}
- if (state->_state_type == StateType::hard) {
- return state->_current_state;
- }
- return state->_last_hard_state;
+ auto state = object->state();
+ return state->_state_type == StateType::hard
+ ? state->_current_state
+ : state->_last_hard_state;
}
case Type::pnp_graph_present:
return _mc->impl<Core>()