diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-29 00:37:10 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-29 00:37:10 +0100 |
commit | f369ec1fa4e2886ce01aeea51044d15f0407fed3 (patch) | |
tree | 5445e7adae55895bcf839cbad3a10c510692053c /lib/Plugins/KerneloopsSysLog.cpp | |
parent | 7a2a2fa7e8d613c69d0fda6c220d97936f56c4fd (diff) | |
download | abrt-f369ec1fa4e2886ce01aeea51044d15f0407fed3.tar.gz abrt-f369ec1fa4e2886ce01aeea51044d15f0407fed3.tar.xz abrt-f369ec1fa4e2886ce01aeea51044d15f0407fed3.zip |
Kerneloops: remove two classes, vector_string_t works as good
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Plugins/KerneloopsSysLog.cpp')
-rw-r--r-- | lib/Plugins/KerneloopsSysLog.cpp | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/lib/Plugins/KerneloopsSysLog.cpp b/lib/Plugins/KerneloopsSysLog.cpp index 886073b..d6f257e 100644 --- a/lib/Plugins/KerneloopsSysLog.cpp +++ b/lib/Plugins/KerneloopsSysLog.cpp @@ -26,45 +26,13 @@ #include "abrtlib.h" #include "KerneloopsSysLog.h" - -#include <list> #include <assert.h> -/* - * This limits the number of oopses we'll submit per session; - * it's important that this is bounded to avoid feedback loops - * for the scenario where submitting an oopses causes a warning/oops - */ -#define MAX_OOPS 16 - -CSysLog::CSysLog() : - m_nFoundOopses(0) -{} - -void CSysLog::QueueOops(char *data, char *version) -{ - if (m_nFoundOopses > MAX_OOPS) - return; - - COops m_NewOops; - m_NewOops.m_sData = data; - m_NewOops.m_sVersion = version; - - m_OopsQueue.push_back(m_NewOops); - m_nFoundOopses++; -} - -void CSysLog::ClearOopsList() +static void queue_oops(vector_string_t &vec, const char *data, const char *version) { - m_OopsQueue.clear(); + vec.push_back(ssprintf("%s\n%s", version, data)); } -const std::list<COops>& CSysLog::GetOopsList() -{ - return m_OopsQueue; -} - - /* * extract_version tries to find the kernel version in given data */ @@ -104,7 +72,7 @@ struct line_info { char level; }; #define REALLOC_CHUNK 1000 -int CSysLog::ExtractOops(char *buffer, size_t buflen) +int extract_oopses(vector_string_t &oopses, char *buffer, size_t buflen) { char *c; enum { maybe, no, yes } syslog_format = maybe; @@ -216,10 +184,9 @@ next_line: int i; char prevlevel = 0; int oopsstart = -1; - int oopsend; + int oopsend = linecount; int inbacktrace = 0; int oopsesfound = 0; - oopsend = linecount; i = 0; while (i < linecount) { @@ -370,7 +337,7 @@ next_line: } /* too short oopses are invalid */ if (strlen(oops) > 100) { - QueueOops(oops, version); + queue_oops(oopses, oops, version); oopsesfound++; } oopsstart = -1; @@ -420,7 +387,7 @@ next_line: } /* too short oopses are invalid */ if (strlen(oops) > 100) { - QueueOops(oops, version); + queue_oops(oopses, oops, version); oopsesfound++; } oopsstart = -1; |