Module: check_mk
Branch: master
Commit: 981ee3f821dae85a3d0fd91c05e8640824785388
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=981ee3f821dae8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jun 8 13:16:23 2012 +0200
Minor code cleanup in Livestatus
---
livestatus/src/LogEntry.cc | 2 +-
livestatus/src/Logfile.cc | 14 +++++++-------
livestatus/src/TableHosts.cc | 4 ++--
livestatus/src/TableLog.cc | 25 ++++---------------------
4 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/livestatus/src/LogEntry.cc b/livestatus/src/LogEntry.cc
index 168f410..4fbc92c 100644
--- a/livestatus/src/LogEntry.cc
+++ b/livestatus/src/LogEntry.cc
@@ -257,7 +257,7 @@ int LogEntry::serviceStateToInt(char *s)
if (*last == ')')
last--;
- // WARN, CRIT, OK, UNKNOWN, RECOVERY
+ // WARN, CRITICAL, OK, UNKNOWN, RECOVERY
switch (*last) {
case 'K': return 0;
case 'Y': return 0;
diff --git a/livestatus/src/Logfile.cc b/livestatus/src/Logfile.cc
index b420e26..9d25212 100644
--- a/livestatus/src/Logfile.cc
+++ b/livestatus/src/Logfile.cc
@@ -34,13 +34,13 @@
extern int num_cached_log_messages;
extern int g_debug_level;
- Logfile::Logfile(const char *path, bool watch)
- : _path(strdup(path))
- , _since(0)
- , _watch(watch)
- , _inode(0)
- , _lineno(0)
- , _logclasses_read(0)
+Logfile::Logfile(const char *path, bool watch)
+ : _path(strdup(path))
+ , _since(0)
+ , _watch(watch)
+ , _inode(0)
+ , _lineno(0)
+ , _logclasses_read(0)
{
int fd = open(path, O_RDONLY);
if (fd < 0) {
diff --git a/livestatus/src/TableHosts.cc b/livestatus/src/TableHosts.cc
index 525fd61..c10440a 100644
--- a/livestatus/src/TableHosts.cc
+++ b/livestatus/src/TableHosts.cc
@@ -63,8 +63,8 @@ bool TableHosts::isAuthorized(contact *ctc, void *data)
}
- TableHosts::TableHosts(bool by_group)
-: _by_group(by_group)
+TableHosts::TableHosts(bool by_group)
+ : _by_group(by_group)
{
struct hostbygroup ref;
addColumns(this, "", -1);
diff --git a/livestatus/src/TableLog.cc b/livestatus/src/TableLog.cc
index 36851d6..b372bc0 100644
--- a/livestatus/src/TableLog.cc
+++ b/livestatus/src/TableLog.cc
@@ -68,10 +68,10 @@ void debug(const char *loginfo, ...)
}
- TableLog::TableLog(unsigned long max_cached_messages)
- : _num_cached_messages(0)
- , _max_cached_messages(max_cached_messages)
- , _num_at_last_check(0)
+TableLog::TableLog(unsigned long max_cached_messages)
+ : _num_cached_messages(0)
+ , _max_cached_messages(max_cached_messages)
+ , _num_at_last_check(0)
{
pthread_mutex_init(&_lock, 0);
@@ -188,23 +188,6 @@ void TableLog::answerQuery(Query *query)
to change this and start with the newest. That way,
the Limit: header produces more reasonable results. */
- /* OLD CODE - OLDEST FIRST
- _logfiles_t::iterator it;
- if (since == 0)
- it = _logfiles.begin();
- else { // find oldest relevant logfile
- it = _logfiles.end();
- while (it != _logfiles.begin() &&
- (it == _logfiles.end() || it->first >= since))
- --it;
- }
- while (it != _logfiles.end()) {
- Logfile *log = it->second;
- if (!log->answerQuery(query, this, since, until, classmask))
- break; // end of time range in this logfile
- ++it;
- } */
-
/* NEW CODE - NEWEST FIRST */
_logfiles_t::iterator it;
it = _logfiles.end(); // it now points beyond last log file