summaryrefslogtreecommitdiffstats
path: root/src/cli/report.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-12-08 14:51:47 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-12-08 14:51:47 +0100
commit816f3e001271ed8ab7fdadb6d90aeb2c61362dac (patch)
treea7e453859a80fb47c7c74cb37791e35ad50f1d97 /src/cli/report.cpp
parent3a9554929de070297a0e816eb2839291335a9403 (diff)
downloadabrt-816f3e001271ed8ab7fdadb6d90aeb2c61362dac.tar.gz
abrt-816f3e001271ed8ab7fdadb6d90aeb2c61362dac.tar.xz
abrt-816f3e001271ed8ab7fdadb6d90aeb2c61362dac.zip
removal of C++isms from libabrt, part 1
This patch converts libabrt usage of C++ map<string, string> to a glib-based container, GHashTable. It is typedef-ed to map_string_h. We can't typedef it to map_string_t, since other parts of ABRT (daemon, cli) still use that name for C++ container. Also, exceptions are removed everywhere. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/cli/report.cpp')
-rw-r--r--src/cli/report.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/cli/report.cpp b/src/cli/report.cpp
index 4c38e852..556e06b4 100644
--- a/src/cli/report.cpp
+++ b/src/cli/report.cpp
@@ -521,26 +521,35 @@ static GHashTable *get_reporter_plugin_settings(const vector_string_t& reporters
if (homedir)
{
GHashTableIter iter;
- gpointer key, value;
-
+ char *key;
+ map_string_t *value;
g_hash_table_iter_init(&iter, settings);
- while (g_hash_table_iter_next(&iter, &key, &value))
+ while (g_hash_table_iter_next(&iter, (void**)&key, (void**)&value))
{
- map_string_t single_plugin_settings;
-
- char *path = xasprintf("%s/.abrt/%s.conf", homedir, (char *)key);
-
- /* Load plugin config in the home dir. Do not skip lines with empty value (but containing a "key="),
- because user may want to override password from /etc/abrt/plugins/*.conf, but he prefers to
- enter it every time he reports. */
- bool success = LoadPluginSettings(path, single_plugin_settings, false);
+ /* Load plugin config in the home dir. Do not skip lines
+ * with empty value (but containing a "key="),
+ * because user may want to override password
+ * from /etc/abrt/plugins/*.conf, but he prefers to
+ * enter it every time he reports. */
+ map_string_h *single_plugin_settings = new_map_string();
+ char *path = xasprintf("%s/.abrt/%s.conf", homedir, key);
+ bool success = load_conf_file(path, single_plugin_settings, /*skip key w/o values:*/ false);
free(path);
if (!success)
+ {
+ free_map_string(single_plugin_settings);
continue;
- // Merge user's plugin settings into already loaded settings.
- map_string_t::const_iterator valit, valitend = single_plugin_settings.end();
- for (valit = single_plugin_settings.begin(); valit != valitend; ++valit)
- (*(map_string_t*)value)[valit->first] = valit->second;
+ }
+
+ /* Merge user's plugin settings into already loaded settings */
+ GHashTableIter iter2;
+ char *key2;
+ char *value2;
+ g_hash_table_iter_init(&iter2, single_plugin_settings);
+ while (g_hash_table_iter_next(&iter2, (void**)&key2, (void**)&value2))
+ (*value)[key2] = xstrdup(value2);
+
+ free_map_string(single_plugin_settings);
}
}
return settings;