On Thu, 2010-12-09 at 15:42 +0100, Karel Klic wrote:
== src/daemon/PluginManager.cpp, method CPluginManager::LoadPlugin
if (enabled_only)
{
if (!string_to_bool(get_map_string_item_or_empty(pluginSettings,
"Enabled")))
{
plugin_info["Enabled"] = "no";
string empty;
plugin_info["Type"] = empty;
...
VERB3 log("Plugin %s: 'Enabled' is not set, not loading it
(yet)", pName);
@@@@@@@@@@@@ MISSING HERE?: free_map_string(pluginSettings);
return NULL; /* error */
}
}
This method CPluginManager::LoadPlugin also works a lot with local
plugin_info structure, which seems to be never used. I guess the whole
CPluginSettings will be removed soon. Or should we remove that dead code?
== src/cli/report.cpp, function get_reporter_plugin_settings():
char *key;
map_string_t *value;
I think 'key' should be renamed to 'plugin_name', and 'value' to
'plugin_settings'. Then
char *key2;
char *value2;
could be renamed to 'key' and 'value'. Those are correct names here,
because the variables represent a key=value pair in a settings file.
Thanks, applying the below patch to git
--
vda
diff -x '*.po' -d -urpN abrt.8/src/cli/report.cpp abrt.9/src/cli/report.cpp
--- abrt.8/src/cli/report.cpp 2010-12-09 12:07:03.673292471 +0100
+++ abrt.9/src/cli/report.cpp 2010-12-13 22:48:12.274478083 +0100
@@ -518,10 +518,10 @@ static GHashTable *get_reporter_plugin_s
if (homedir)
{
GHashTableIter iter;
- char *key;
- map_string_t *value;
+ char *plugin_name;
+ map_string_t *plugin_settings;
g_hash_table_iter_init(&iter, settings);
- while (g_hash_table_iter_next(&iter, (void**)&key, (void**)&value))
+ while (g_hash_table_iter_next(&iter, (void**)&plugin_name, (void**)&plugin_settings))
{
/* Load plugin config in the home dir. Do not skip lines
* with empty value (but containing a "key="),
@@ -529,7 +529,7 @@ static GHashTable *get_reporter_plugin_s
* from /etc/abrt/plugins/foo.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);
+ char *path = xasprintf("%s/.abrt/%s.conf", homedir, plugin_name);
bool success = load_conf_file(path, single_plugin_settings, /*skip key w/o values:*/ false);
free(path);
if (!success)
@@ -540,11 +540,11 @@ static GHashTable *get_reporter_plugin_s
/* Merge user's plugin settings into already loaded settings */
GHashTableIter iter2;
- char *key2;
- char *value2;
+ char *key;
+ char *value;
g_hash_table_iter_init(&iter2, single_plugin_settings);
- while (g_hash_table_iter_next(&iter2, (void**)&key2, (void**)&value2))
- (*value)[key2] = xstrdup(value2);
+ while (g_hash_table_iter_next(&iter2, (void**)&key, (void**)&value))
+ (*plugin_settings)[key] = xstrdup(value);
free_map_string(single_plugin_settings);
}
diff -x '*.po' -d -urpN abrt.8/src/daemon/PluginManager.cpp abrt.9/src/daemon/PluginManager.cpp
--- abrt.8/src/daemon/PluginManager.cpp 2010-12-08 15:10:52.000000000 +0100
+++ abrt.9/src/daemon/PluginManager.cpp 2010-12-13 22:43:34.606478963 +0100
@@ -149,6 +149,7 @@ CPlugin* CPluginManager::LoadPlugin(cons
plugin_info["WWW"] = empty;
plugin_info["GTKBuilder"] = empty;
VERB3 log("Plugin %s: 'Enabled' is not set, not loading it (yet)", pName);
+ free_map_string(pluginSettings);
return NULL; /* error */
}
}