Module: check_mk
Branch: master
Commit: 7f8053572719827be9c97997d9a8529300da1e70
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7f805357271982…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jul 19 14:37:34 2017 +0200
Turn a field into a simple local variable.
Change-Id: Ia50479b861cb964ebc172fec0314cdcf82d6ac6c
---
livestatus/src/LogEntry.cc | 8 ++++----
livestatus/src/LogEntry.h | 1 -
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/livestatus/src/LogEntry.cc b/livestatus/src/LogEntry.cc
index ed3b0b3..552786e 100644
--- a/livestatus/src/LogEntry.cc
+++ b/livestatus/src/LogEntry.cc
@@ -57,9 +57,9 @@ LogEntry::LogEntry(MonitoringCore *mc, unsigned lineno, const char
*line)
// make a copy of the message and strip trailing newline
_msg = strdup(line);
- _msglen = strlen(line);
- while (_msglen > 0 && _msg[_msglen - 1] == '\n') {
- _msg[--_msglen] = '\0';
+ size_t msglen = strlen(line);
+ while (msglen > 0 && _msg[msglen - 1] == '\n') {
+ _msg[--msglen] = '\0';
// keep unsplitted copy of the message (needs lots of memory,
// maybe we could optimize that one day...)
@@ -80,7 +80,7 @@ LogEntry::LogEntry(MonitoringCore *mc, unsigned lineno, const char
*line)
}
// [1260722267] xxx - extract timestamp, validate message
- if (_msglen < 13 || _msg[0] != '[' || _msg[11] != ']') {
+ if (msglen < 13 || _msg[0] != '[' || _msg[11] != ']') {
_logclass = Class::invalid;
return; // ignore invalid lines silently
}
diff --git a/livestatus/src/LogEntry.h b/livestatus/src/LogEntry.h
index 18d11b4..a976c43 100644
--- a/livestatus/src/LogEntry.h
+++ b/livestatus/src/LogEntry.h
@@ -83,7 +83,6 @@ public:
char *_complete; // copy of complete unsplit message
char *_options; // points into _complete after ':'
char *_msg; // split up with binary zeroes
- unsigned _msglen; // size of _msg
char *_text; // points into msg
char *_host_name; // points into msg or is 0
char *_svc_desc; // points into msg or is 0