summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/CrashTypes.h7
-rw-r--r--inc/abrt_types.h42
-rw-r--r--lib/CommLayer/DBusCommon.h11
-rw-r--r--lib/MiddleWare/Makefile.am1
-rw-r--r--lib/MiddleWare/MiddleWareTypes.h16
-rw-r--r--lib/MiddleWare/Plugin.h5
-rw-r--r--lib/Plugins/CCpp.cpp1
-rw-r--r--src/Daemon/Daemon.cpp13
-rw-r--r--src/Daemon/Daemon.h2
-rw-r--r--src/Daemon/MiddleWare.cpp15
-rw-r--r--src/Daemon/MiddleWare.h7
-rw-r--r--src/Daemon/PluginManager.h4
-rw-r--r--src/Daemon/RPM.h3
-rw-r--r--src/Daemon/Settings.cpp19
-rw-r--r--src/Daemon/Settings.h16
15 files changed, 82 insertions, 80 deletions
diff --git a/inc/CrashTypes.h b/inc/CrashTypes.h
index 61975037..e5001f69 100644
--- a/inc/CrashTypes.h
+++ b/inc/CrashTypes.h
@@ -1,9 +1,7 @@
#ifndef CRASHTYPES_H_
#define CRASHTYPES_H_
-#include <string>
-#include <map>
-#include <vector>
+#include "abrt_types.h"
// SYS - system value, should not be displayed
// BIN - binary value, should be displayed as a path to binary file
@@ -39,8 +37,7 @@
#define CD_MWUUID "_MWUUID"
#define CD_MWDDD "_MWDDD"
-// now, size of a vecor is always 3 -> <type, editable, content>
-typedef std::vector<std::string> vector_strings_t;
+// currently, vector always has exactly 3 elements -> <type, editable, content>
// <key, data>
typedef std::map<std::string, vector_strings_t> map_crash_data_t;
diff --git a/inc/abrt_types.h b/inc/abrt_types.h
new file mode 100644
index 00000000..76d03275
--- /dev/null
+++ b/inc/abrt_types.h
@@ -0,0 +1,42 @@
+/*
+ Copyright (C) 2009 Denys Vlasenko (dvlasenk@redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef ABRT_TYPES_H_
+#define ABRT_TYPES_H_
+
+#include <map>
+#include <set>
+#include <vector>
+#include <string>
+
+typedef std::vector<std::string> vector_strings_t;
+typedef std::set<std::string> set_strings_t;
+typedef std::pair<std::string, std::string> pair_string_string_t;
+typedef std::map<std::string, std::string> map_string_string_t;
+
+typedef std::vector<pair_string_string_t> vector_pair_string_string_t;
+typedef std::vector<map_string_string_t> vector_map_string_string_t;
+typedef std::map<std::string, vector_pair_string_string_t> map_vector_pair_string_string_t;
+
+/* Report() method return type */
+typedef std::map<std::string, vector_strings_t> report_status_t;
+/* Holds result of .conf file parsing */
+typedef std::map<std::string, std::string> map_plugin_settings_t;
+
+#endif
diff --git a/lib/CommLayer/DBusCommon.h b/lib/CommLayer/DBusCommon.h
index 0addf08f..b3e3af2c 100644
--- a/lib/CommLayer/DBusCommon.h
+++ b/lib/CommLayer/DBusCommon.h
@@ -17,12 +17,13 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef DBUSCOMMON_H_
+#define DBUSCOMMON_H_
+
+#include "CrashTypes.h"
+
#define CC_DBUS_NAME "com.redhat.abrt"
#define CC_DBUS_PATH "/com/redhat/abrt"
#define CC_DBUS_IFACE "com.redhat.abrt"
-#include "CrashTypes.h"
-typedef std::map<std::string, std::string> map_string_string_t;
-typedef std::vector<map_string_string_t> vector_map_string_string_t;
-typedef std::map<std::string, std::string> map_plugin_settings_t;
-typedef std::map<std::string, vector_strings_t> report_status_t;
+#endif
diff --git a/lib/MiddleWare/Makefile.am b/lib/MiddleWare/Makefile.am
index 1d82d7d3..0db4f79e 100644
--- a/lib/MiddleWare/Makefile.am
+++ b/lib/MiddleWare/Makefile.am
@@ -2,7 +2,6 @@ lib_LTLIBRARIES = libABRTMiddleWare.la
libABRTMiddleWare_la_SOURCES = \
Plugin.cpp Plugin.h \
- MiddleWareTypes.h \
Action.h Database.h Reporter.h Analyzer.h
libABRTMiddleWare_la_LIBADD = \
$(DL_LIBS) \
diff --git a/lib/MiddleWare/MiddleWareTypes.h b/lib/MiddleWare/MiddleWareTypes.h
deleted file mode 100644
index a79b12b4..00000000
--- a/lib/MiddleWare/MiddleWareTypes.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef MIDDLEWARETYPES_H_
-#define MIDDLEWARETYPES_H_
-
-#include <map>
-#include <set>
-#include <vector>
-#include <string>
-
-typedef std::vector<std::string> vector_strings_t;
-typedef std::pair<std::string, std::string> pair_string_string_t;
-typedef std::vector<pair_string_string_t> vector_pair_string_string_t;
-typedef std::map<std::string, std::string> map_string_string_t;
-typedef std::vector<map_string_string_t> vector_map_string_string_t;
-typedef std::set<std::string> set_strings_t;
-
-#endif /* MIDDLEWARETYPES_H_ */
diff --git a/lib/MiddleWare/Plugin.h b/lib/MiddleWare/Plugin.h
index 638840ff..f3533a1e 100644
--- a/lib/MiddleWare/Plugin.h
+++ b/lib/MiddleWare/Plugin.h
@@ -23,8 +23,7 @@
#ifndef PLUGIN_H_
#define PLUGIN_H_
-#include <string>
-#include <map>
+#include "abrt_types.h"
#define PLUGINS_MAGIC_NUMBER 6
@@ -32,8 +31,6 @@
#define PLUGINS_LIB_EXTENSION "so"
#define PLUGINS_LIB_PREFIX "lib"
-typedef std::map<std::string, std::string> map_plugin_settings_t;
-
/**
* An abstract class. The class defines a common plugin interface. If a plugin
* has some settings, then a *Settings(*) method has to be written.
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index b7416563..9b10c752 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -426,7 +426,6 @@ I think the below code has absolutely the same effect:
std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
{
-///
update_client("Getting local universal unique identification...");
CDebugDump dd;
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 1ee53645..4f6065c2 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -24,6 +24,7 @@
#include <string>
#include "abrtlib.h"
#include "ABRTException.h"
+#include "RPM.h"
#include "CrashWatcher.h"
#include "Daemon.h"
@@ -156,7 +157,7 @@ static void SetUpMW()
{
g_pPluginManager->RegisterPlugin(*it_p);
}
- vector_pair_strings_t::iterator it_ar = g_settings_vectorActionsAndReporters.begin();
+ vector_pair_string_string_t::iterator it_ar = g_settings_vectorActionsAndReporters.begin();
for (; it_ar != g_settings_vectorActionsAndReporters.end(); it_ar++)
{
AddActionOrReporter((*it_ar).first, (*it_ar).second);
@@ -164,7 +165,7 @@ static void SetUpMW()
map_analyzer_actions_and_reporters_t::iterator it_aar = g_settings_mapAnalyzerActionsAndReporters.begin();
for (; it_aar != g_settings_mapAnalyzerActionsAndReporters.end(); it_aar++)
{
- vector_pair_strings_t::iterator it_ar = it_aar->second.begin();
+ vector_pair_string_string_t::iterator it_ar = it_aar->second.begin();
for (; it_ar != it_aar->second.end(); it_ar++)
{
AddAnalyzerActionOrReporter(it_aar->first, (*it_ar).first, (*it_ar).second);
@@ -211,8 +212,8 @@ static int SetUpCron()
if (nS != -1)
{
- vector_pair_strings_t::iterator it_ar;
- for (it_ar = it_c->second.begin(); it_ar != it_c->second.end(); it_ar++)
+ vector_pair_string_string_t::iterator it_ar = it_c->second.begin();
+ for (; it_ar != it_c->second.end(); it_ar++)
{
cron_callback_data_t* cronPeriodicCallbackData = new cron_callback_data_t((*it_ar).first, (*it_ar).second, timeout);
g_timeout_add_seconds_full(G_PRIORITY_DEFAULT,
@@ -245,8 +246,8 @@ static int SetUpCron()
{
timeout = nextTime - actTime;
}
- vector_pair_strings_t::iterator it_ar;
- for (it_ar = it_c->second.begin(); it_ar != it_c->second.end(); it_ar++)
+ vector_pair_string_string_t::iterator it_ar = it_c->second.begin();
+ for (; it_ar != it_c->second.end(); it_ar++)
{
cron_callback_data_t* cronOneCallbackData = new cron_callback_data_t((*it_ar).first, (*it_ar).second, timeout);
g_timeout_add_seconds_full(G_PRIORITY_DEFAULT,
diff --git a/src/Daemon/Daemon.h b/src/Daemon/Daemon.h
index c47d1622..74f4a82f 100644
--- a/src/Daemon/Daemon.h
+++ b/src/Daemon/Daemon.h
@@ -21,7 +21,7 @@
#define DAEMON_H_
#include <pthread.h>
-#include "MiddleWareTypes.h"
+#include "abrt_types.h"
#include "CrashTypes.h"
class CCrashWatcher;
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 4d4b8c68..308331de 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -22,6 +22,7 @@
#include "abrtlib.h"
#include "Daemon.h"
#include "Settings.h"
+#include "RPM.h"
#include "DebugDump.h"
#include "ABRTException.h"
#include "CommLayerInner.h"
@@ -50,6 +51,7 @@ set_strings_t g_setBlackList;
* action or reporter plugins. These are activated when a crash, which
* is maintained by particular analyzer, occurs.
*/
+typedef std::map<std::string, vector_pair_string_string_t> map_analyzer_actions_and_reporters_t;
static map_analyzer_actions_and_reporters_t s_mapAnalyzerActionsAndReporters;
/**
* A vector of one or more action or reporter plugins. These are
@@ -248,8 +250,8 @@ void RunAction(const std::string& pActionDir,
void RunActionsAndReporters(const std::string& pDebugDumpDir)
{
- vector_pair_string_string_t::iterator it_ar;
- for (it_ar = s_vectorActionsAndReporters.begin(); it_ar != s_vectorActionsAndReporters.end(); it_ar++)
+ vector_pair_string_string_t::iterator it_ar = s_vectorActionsAndReporters.begin();
+ for (; it_ar != s_vectorActionsAndReporters.end(); it_ar++)
{
try
{
@@ -402,9 +404,8 @@ static bool IsDebugDumpSaved(const std::string& pUID,
const std::string& pDebugDumpDir)
{
CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase);
- vector_database_rows_t rows;
database->Connect();
- rows = database->GetUIDData(pUID);
+ vector_database_rows_t rows = database->GetUIDData(pUID);
database->DisConnect();
int ii;
@@ -504,10 +505,8 @@ static void RunAnalyzerActions(const std::string& pAnalyzer, const std::string&
{
if (s_mapAnalyzerActionsAndReporters.find(pAnalyzer) != s_mapAnalyzerActionsAndReporters.end())
{
- vector_pair_string_string_t::iterator it_a;
- for (it_a = s_mapAnalyzerActionsAndReporters[pAnalyzer].begin();
- it_a != s_mapAnalyzerActionsAndReporters[pAnalyzer].end();
- it_a++)
+ vector_pair_string_string_t::iterator it_a = s_mapAnalyzerActionsAndReporters[pAnalyzer].begin();
+ for (; it_a != s_mapAnalyzerActionsAndReporters[pAnalyzer].end(); it_a++)
{
try
{
diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h
index b781e65f..a127c230 100644
--- a/src/Daemon/MiddleWare.h
+++ b/src/Daemon/MiddleWare.h
@@ -23,10 +23,8 @@
#ifndef MIDDLEWARE_H_
#define MIDDLEWARE_H_
+#include "abrt_types.h"
#include "PluginManager.h"
-#include "CrashTypes.h"
-#include "MiddleWareTypes.h"
-#include "RPM.h"
/**
* An enum contains all return codes.
@@ -52,9 +50,6 @@ typedef enum {
RS_MESSAGE
} report_status_items_t;
-typedef std::map<std::string, vector_strings_t> report_status_t;
-typedef std::map<std::string, vector_pair_string_string_t> map_analyzer_actions_and_reporters_t;
-
/**
* Takes care of getting all additional data needed
diff --git a/src/Daemon/PluginManager.h b/src/Daemon/PluginManager.h
index 6cf84f39..75a1bb27 100644
--- a/src/Daemon/PluginManager.h
+++ b/src/Daemon/PluginManager.h
@@ -23,15 +23,13 @@
#ifndef PLUGINMANAGER_H_
#define PLUGINMANAGER_H_
-#include <map>
-#include <string>
+#include "abrt_types.h"
#include "ABRTPlugin.h"
#include "Plugin.h"
#include "Analyzer.h"
#include "Reporter.h"
#include "Database.h"
#include "Action.h"
-#include "MiddleWareTypes.h"
/**
* A class. It takes care of loading, registering and manipulating with
diff --git a/src/Daemon/RPM.h b/src/Daemon/RPM.h
index 1be0eb11..a7a9d2ef 100644
--- a/src/Daemon/RPM.h
+++ b/src/Daemon/RPM.h
@@ -23,11 +23,10 @@
#ifndef RPM_H_
#define RPM_H_
-#include "MiddleWareTypes.h"
-
#include <rpm/rpmcli.h>
#include <rpm/rpmts.h>
#include <rpm/rpmdb.h>
+#include "abrt_types.h"
/**
* A class. It is used for additional checks of package, which contains
diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp
index 468213dc..83aad1e9 100644
--- a/src/Daemon/Settings.cpp
+++ b/src/Daemon/Settings.cpp
@@ -18,6 +18,7 @@ vector_pair_string_string_t g_settings_vectorActionsAndReporters;
map_analyzer_actions_and_reporters_t g_settings_mapAnalyzerActionsAndReporters;
+typedef std::map<std::string, std::string> map_settings_t;
static map_settings_t s_mapSettingsCommon;
static map_settings_t s_mapSettingsAnalyzerActionsAndReporters;
static map_settings_t s_mapSettingsCron;
@@ -47,9 +48,9 @@ static set_strings_t ParseList(const std::string& pList)
return set;
}
-static vector_pair_strings_t ParseListWithArgs(const std::string& pValue)
+static vector_pair_string_string_t ParseListWithArgs(const std::string& pValue)
{
- vector_pair_strings_t pluginsWithArgs;
+ vector_pair_string_string_t pluginsWithArgs;
unsigned int ii;
std::string item = "";
std::string action = "";
@@ -132,7 +133,7 @@ static void ParseCron()
map_settings_t::iterator it = s_mapSettingsCron.begin();
for (; it != s_mapSettingsCron.end(); it++)
{
- vector_pair_strings_t actionsAndReporters = ParseListWithArgs(it->second);
+ vector_pair_string_string_t actionsAndReporters = ParseListWithArgs(it->second);
g_settings_mapCron[it->first] = actionsAndReporters;
}
}
@@ -185,7 +186,7 @@ static void ParseAnalyzerActionsAndReporters()
for (; it != s_mapSettingsAnalyzerActionsAndReporters.end(); it++)
{
set_strings_t keys = ParseKey(it->first);
- vector_pair_strings_t actionsAndReporters = ParseListWithArgs(it->second);
+ vector_pair_string_string_t actionsAndReporters = ParseListWithArgs(it->second);
set_strings_t::iterator it_keys = keys.begin();
for (; it_keys != keys.end(); it_keys++)
{
@@ -288,13 +289,13 @@ void LoadSettings(const char* pPath)
static void SaveSetString(const std::string& pKey, const set_strings_t& pSet, std::ofstream& pFOut, bool pNewLine = true)
{
- set_strings_t::const_iterator it_set;
if (pKey != "")
{
pFOut << pKey << " = ";
}
int ii = 0;
- for (it_set = pSet.begin(); it_set != pSet.end(); it_set++)
+ set_strings_t::const_iterator it_set = pSet.begin();
+ for (; it_set != pSet.end(); it_set++)
{
pFOut << (*it_set);
ii++;
@@ -334,10 +335,10 @@ static void SaveVectorPairStrings(const std::string& pKey, const vector_pair_str
}
}
-static void SaveMapVectorPairStrings(const map_vector_pair_strings_t& pMap, std::ofstream& pFOut, bool pNewLine = true)
+static void SaveMapVectorPairStrings(const map_vector_pair_string_string_t& pMap, std::ofstream& pFOut, bool pNewLine = true)
{
- map_vector_pair_strings_t::const_iterator it;
- for (it = pMap.begin(); it != pMap.end(); it++)
+ map_vector_pair_string_string_t::const_iterator it = pMap.begin();
+ for (; it != pMap.end(); it++)
{
pFOut << it->first << " = ";
SaveVectorPairStrings("", it->second, pFOut, false);
diff --git a/src/Daemon/Settings.h b/src/Daemon/Settings.h
index 3d3154f6..d80bed04 100644
--- a/src/Daemon/Settings.h
+++ b/src/Daemon/Settings.h
@@ -1,20 +1,10 @@
#ifndef SETTINGS_H_
#define SETTINGS_H_
-#include <string>
-#include <map>
-#include <set>
-#include <vector>
+#include "abrt_types.h"
-#include "MiddleWareTypes.h"
-
-typedef std::map<std::string, std::string> map_settings_t;
-typedef std::set<std::string> set_strings_t;
-typedef std::pair<std::string, std::string> pair_string_string_t;
-typedef std::vector<pair_string_string_t> vector_pair_strings_t;
-typedef std::map<std::string, vector_pair_strings_t> map_vector_pair_strings_t;
-typedef map_vector_pair_strings_t map_analyzer_actions_and_reporters_t;
-typedef map_vector_pair_strings_t map_cron_t;
+typedef map_vector_pair_string_string_t map_analyzer_actions_and_reporters_t;
+typedef map_vector_pair_string_string_t map_cron_t;
void LoadSettings(const char* pPath);
void SaveSettings(const char* pPath);