From 951fb690f1cde250f4d3cc6565ec4fc63f5df8fa Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 24 Aug 2009 16:42:15 +0200 Subject: trivial simplification: make LoadSettings() take char*, not string& param and some cosmetics... Signed-off-by: Denys Vlasenko --- src/Daemon/CommLayerServerDBus.cpp | 9 ++++----- src/Daemon/Daemon.cpp | 2 +- src/Daemon/Settings.cpp | 27 ++++++++++++++------------- src/Daemon/Settings.h | 12 ++++++------ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index f1e36592..7fa4fb65 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -4,12 +4,11 @@ DBus::Connection *CCommLayerServerDBus::init_dbus(CCommLayerServerDBus *self) { - CCommLayerServerDBus *server = (CCommLayerServerDBus*) self; - server->m_pDispatcher = new DBus::Glib::BusDispatcher(); - server->m_pDispatcher->attach(NULL); + self->m_pDispatcher = new DBus::Glib::BusDispatcher(); + self->m_pDispatcher->attach(NULL); DBus::default_dispatcher = self->m_pDispatcher; - server->m_pConn = new DBus::Connection(DBus::Connection::SystemBus()); - return server->m_pConn; + self->m_pConn = new DBus::Connection(DBus::Connection::SystemBus()); + return self->m_pConn; } CCommLayerServerDBus::CCommLayerServerDBus() diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 00c07c2d..47a963cf 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -581,7 +581,7 @@ int main(int argc, char** argv) if (inotify_add_watch(inotify_fd, DEBUG_DUMPS_DIR, IN_CREATE) == -1) perror_msg_and_die("inotify_add_watch failed on '%s'", DEBUG_DUMPS_DIR); /* (comment here) */ - LoadSettings(std::string(CONF_DIR) + "/abrt.conf"); + LoadSettings(CONF_DIR"/abrt.conf"); /* (comment here) */ g_pMainloop = g_main_loop_new(NULL, FALSE); /* (comment here) */ diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp index 955bd1bd..b7497ef4 100644 --- a/src/Daemon/Settings.cpp +++ b/src/Daemon/Settings.cpp @@ -9,13 +9,14 @@ set_strings_t g_settings_setOpenGPGPublicKeys; set_strings_t g_settings_mapSettingsBlackList; -vector_pair_string_string_t g_settings_vectorActionsAndReporters; set_strings_t g_settings_setEnabledPlugins; +unsigned int g_settings_nMaxCrashReportsSize = 1000; +bool g_settings_bOpenGPGCheck = false; +std::string g_settings_sDatabase; +map_cron_t g_settings_mapCron; +vector_pair_string_string_t g_settings_vectorActionsAndReporters; map_analyzer_actions_and_reporters_t g_settings_mapAnalyzerActionsAndReporters; -unsigned int g_settings_nMaxCrashReportsSize = 1000; -bool g_settings_bOpenGPGCheck = false; -std::string g_settings_sDatabase; -map_cron_t g_settings_mapCron; + static map_settings_t s_mapSettingsCommon; static map_settings_t s_mapSettingsAnalyzerActionsAndReporters; @@ -128,8 +129,8 @@ static void ParseCommon() static void ParseCron() { - map_settings_t::iterator it; - for (it = s_mapSettingsCron.begin(); it != s_mapSettingsCron.end(); it++) + map_settings_t::iterator it = s_mapSettingsCron.begin(); + for (; it != s_mapSettingsCron.end(); it++) { vector_pair_strings_t actionsAndReporters = ParseListWithArgs(it->second); g_settings_mapCron[it->first] = actionsAndReporters; @@ -180,23 +181,23 @@ static set_strings_t ParseKey(const std::string& Key) static void ParseAnalyzerActionsAndReporters() { - map_settings_t::iterator it; - for (it = s_mapSettingsAnalyzerActionsAndReporters.begin(); it != s_mapSettingsAnalyzerActionsAndReporters.end(); it++) + map_settings_t::iterator it = s_mapSettingsAnalyzerActionsAndReporters.begin(); + for (; it != s_mapSettingsAnalyzerActionsAndReporters.end(); it++) { set_strings_t keys = ParseKey(it->first); vector_pair_strings_t actionsAndReporters = ParseListWithArgs(it->second); - set_strings_t::iterator it_keys; - for (it_keys = keys.begin(); it_keys != keys.end(); it_keys++) + set_strings_t::iterator it_keys = keys.begin(); + for (; it_keys != keys.end(); it_keys++) { g_settings_mapAnalyzerActionsAndReporters[*it_keys] = actionsAndReporters; } } } -void LoadSettings(const std::string& pPath) +void LoadSettings(const char* pPath) { std::ifstream fIn; - fIn.open(pPath.c_str()); + fIn.open(pPath); if (fIn.is_open()) { std::string line; diff --git a/src/Daemon/Settings.h b/src/Daemon/Settings.h index 2df3806b..c95786d3 100644 --- a/src/Daemon/Settings.h +++ b/src/Daemon/Settings.h @@ -15,16 +15,16 @@ typedef std::vector vector_pair_strings_t; typedef std::map map_analyzer_actions_and_reporters_t; typedef std::map map_cron_t; -void LoadSettings(const std::string& pPath); +void LoadSettings(const char* pPath); extern set_strings_t g_settings_setOpenGPGPublicKeys; extern set_strings_t g_settings_mapSettingsBlackList; -extern vector_pair_string_string_t g_settings_vectorActionsAndReporters; extern set_strings_t g_settings_setEnabledPlugins; +extern unsigned int g_settings_nMaxCrashReportsSize; +extern bool g_settings_bOpenGPGCheck; +extern std::string g_settings_sDatabase; +extern map_cron_t g_settings_mapCron; +extern vector_pair_string_string_t g_settings_vectorActionsAndReporters; extern map_analyzer_actions_and_reporters_t g_settings_mapAnalyzerActionsAndReporters; -extern unsigned int g_settings_nMaxCrashReportsSize; -extern bool g_settings_bOpenGPGCheck; -extern std::string g_settings_sDatabase; -extern map_cron_t g_settings_mapCron; #endif -- cgit