Module: check_mk
Branch: master
Commit: 8a9bd5e64c292f82042195d3f722a18ad5516de3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a9bd5e64c292f…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Dec 3 10:09:43 2015 +0100
Removed dead code.
See
http://blog.codinghorror.com/code-smells/ ;-)
Note that there is still some code which is dead in livestatus, but actually
used in cmc => design problem, solved later. At least cmc contains no
zombies anymore now.
---
livestatus/src/LogCache.cc | 11 ---------
livestatus/src/LogCache.h | 1 -
livestatus/src/Query.cc | 16 -------------
livestatus/src/Query.h | 1 -
livestatus/src/TableStateHistory.cc | 45 -----------------------------------
livestatus/src/TableStateHistory.h | 1 -
livestatus/src/module.c | 2 ++
7 files changed, 2 insertions(+), 75 deletions(-)
diff --git a/livestatus/src/LogCache.cc b/livestatus/src/LogCache.cc
index c433957..68f3189 100644
--- a/livestatus/src/LogCache.cc
+++ b/livestatus/src/LogCache.cc
@@ -183,17 +183,6 @@ void LogCache::scanLogfile(char *path, bool watch)
delete logfile;
}
-void LogCache::dumpLogfiles()
-{
- for (_logfiles_t::iterator it = _logfiles.begin();
- it != _logfiles.end();
- ++it)
- {
- Logfile *log = it->second;
- debug("LOG %s from %d, %u messages, classes: 0x%04x", log->path(),
log->since(), log->numEntries(), log->classesRead());
- }
-}
-
/* This method is called each time a log message is loaded
into memory. If the number of messages loaded in memory
is to large, memory will be freed by flushing logfiles
diff --git a/livestatus/src/LogCache.h b/livestatus/src/LogCache.h
index 75505f5..0aa51d0 100644
--- a/livestatus/src/LogCache.h
+++ b/livestatus/src/LogCache.h
@@ -64,7 +64,6 @@ public:
private:
void scanLogfile(char *path, bool watch);
_logfiles_t::iterator findLogfileStartingBefore(time_t);
- void dumpLogfiles();
};
#endif // LogCache_h
diff --git a/livestatus/src/Query.cc b/livestatus/src/Query.cc
index adb49c5..57b5896 100644
--- a/livestatus/src/Query.cc
+++ b/livestatus/src/Query.cc
@@ -1096,22 +1096,6 @@ void Query::outputUnicodeEscape(unsigned value)
_output->addBuffer(buf, 6);
}
-void Query::outputHostService(const char *host_name, const char *service_description)
-{
- if (_output_format == OUTPUT_FORMAT_CSV) {
- outputString(host_name);
- _output->addBuffer(_host_service_separator.c_str(),
_host_service_separator.size());
- outputString(service_description);
- }
- else {
- _output->addChar('[');
- outputString(host_name);
- _output->addChar(',');
- outputString(service_description);
- _output->addChar(']');
- }
-}
-
void Query::outputBlob(const char *buffer, int size)
{
if (_output_format != OUTPUT_FORMAT_CSV)
diff --git a/livestatus/src/Query.h b/livestatus/src/Query.h
index 6936584..16b4201 100644
--- a/livestatus/src/Query.h
+++ b/livestatus/src/Query.h
@@ -120,7 +120,6 @@ public:
void outputUnicodeEscape(unsigned value);
void outputString(const char *, int size=-1);
void outputBlob(const char *buffer, int size);
- void outputHostService(const char *, const char *);
void outputBeginList();
void outputListSeparator();
void outputEndList();
diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc
index 12a6bc4..4c47ca6 100644
--- a/livestatus/src/TableStateHistory.cc
+++ b/livestatus/src/TableStateHistory.cc
@@ -23,8 +23,6 @@
// Boston, MA 02110-1301 USA.
#include "TableStateHistory.h"
-#include <stdarg.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
@@ -70,44 +68,6 @@ using std::string;
int g_disable_statehist_filtering = 0;
extern Store *g_store;
-// Debugging logging is hard if debug messages are logged themselves...
-void debug_statehist(const char *loginfo, ...)
-{
- FILE *x = fopen("/tmp/livestatus_state.log", "a+");
- va_list ap;
- va_start(ap, loginfo);
- vfprintf(x, loginfo, ap);
- fputc('\n', x);
- va_end(ap);
- fclose(x);
-}
-
-
-// Debug output of HostServiceState struct
-void log_hst(HostServiceState *state)
-{
- debug_statehist("\n++++++++++++++\nSTATE INFO");
- if (state->_host_name)
- debug_statehist("host name %s", state->_host_name);
- if (state->_service_description)
- debug_statehist("svc description %s", state->_service_description);
-
- debug_statehist("time %d", state->_time);
- debug_statehist("state %d", state->_state);
- if (state->_log_output)
- debug_statehist("check_output %s", state->_log_output);
- if (state->_debug_info)
- debug_statehist("debug_info %s", state->_debug_info);
- if (state->_notification_period)
- debug_statehist("notification period %s",
state->_notification_period);
- if (state->_service_period)
- debug_statehist("service period %s", state->_service_period);
- debug_statehist("from %d", state->_from);
- debug_statehist("until %d", state->_until);
- debug_statehist("duration %d", state->_duration);
-}
-
-
#ifndef CMC
const char *getCustomVariable(customvariablesmember *cvm, const char *name)
{
@@ -647,11 +607,6 @@ void TableStateHistory::answerQuery(Query *query)
object_blacklist.clear();
}
-bool TableStateHistory::objectFilteredOut(Query *, void *)
-{
- return false;
-}
-
int TableStateHistory::updateHostServiceState(Query *query, const LogEntry *entry,
HostServiceState *hs_state, const bool only_update){
int state_changed = 1;
diff --git a/livestatus/src/TableStateHistory.h b/livestatus/src/TableStateHistory.h
index 74850b8..5f93bef 100644
--- a/livestatus/src/TableStateHistory.h
+++ b/livestatus/src/TableStateHistory.h
@@ -77,7 +77,6 @@ private:
LogEntry* getPreviousLogentry();
LogEntry* getNextLogentry();
void process(Query *query, HostServiceState *hs_state);
- bool objectFilteredOut(Query *, void *entry);
};
#endif // TableStateHistory_h
diff --git a/livestatus/src/module.c b/livestatus/src/module.c
index 89574ad..518cde8 100644
--- a/livestatus/src/module.c
+++ b/livestatus/src/module.c
@@ -775,6 +775,7 @@ void omd_advertize()
/* this function gets called when the module is loaded by the event broker */
+/* cppcheck-suppress unusedFunction */
int nebmodule_init(int flags __attribute__ ((__unused__)), char *args, void *handle)
{
g_nagios_handle = handle;
@@ -814,6 +815,7 @@ int nebmodule_init(int flags __attribute__ ((__unused__)), char *args,
void *han
}
+/* cppcheck-suppress unusedFunction */
int nebmodule_deinit(int flags __attribute__ ((__unused__)), int reason __attribute__
((__unused__)))
{
logger(LG_INFO, "deinitializing");