diff options
author | Karel Klic <kklic@redhat.com> | 2010-02-12 16:08:30 +0100 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2010-02-12 16:08:30 +0100 |
commit | a4ff7719867332304e5b44d7e24e3333dab256b6 (patch) | |
tree | 2fb6677121129800442995a903d8a0b754616381 /src | |
parent | e08c1d7c3c56c99cafde076529b17c956ef3aeb0 (diff) | |
download | abrt-a4ff7719867332304e5b44d7e24e3333dab256b6.tar.gz abrt-a4ff7719867332304e5b44d7e24e3333dab256b6.tar.xz abrt-a4ff7719867332304e5b44d7e24e3333dab256b6.zip |
Move LoadPluginSettings to the shared utils library. Add parameter skipKeysWithoutValue.
Diffstat (limited to 'src')
-rw-r--r-- | src/Daemon/PluginManager.cpp | 54 | ||||
-rw-r--r-- | src/Daemon/PluginManager.h | 9 |
2 files changed, 0 insertions, 63 deletions
diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index e63cb3ac..f01d9435 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.cpp @@ -80,60 +80,6 @@ static const char *const plugin_type_str[] = { }; -bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings) -{ - FILE *fp = fopen(pPath, "r"); - if (!fp) - return false; - - char line[512]; - while (fgets(line, sizeof(line), fp)) - { - strchrnul(line, '\n')[0] = '\0'; - unsigned ii; - bool is_value = false; - bool valid = false; - bool in_quote = false; - string key; - string value; - for (ii = 0; line[ii] != '\0'; ii++) - { - if (line[ii] == '"') - { - in_quote = !in_quote; - } - if (isspace(line[ii]) && !in_quote) - { - continue; - } - if (line[ii] == '#' && !in_quote && key == "") - { - break; - } - if (line[ii] == '=' && !in_quote) - { - is_value = true; - continue; - } - if (!is_value) - { - key += line[ii]; - } - else - { - valid = true; - value += line[ii]; - } - } - if (valid && !in_quote) - { - pSettings[key] = value; - } - } - fclose(fp); - return true; -} - /** * A function. It saves settings. On success it returns true, otherwise returns false. * @param path A path of config file. diff --git a/src/Daemon/PluginManager.h b/src/Daemon/PluginManager.h index b5dcebc5..bf6952f4 100644 --- a/src/Daemon/PluginManager.h +++ b/src/Daemon/PluginManager.h @@ -154,13 +154,4 @@ class CPluginManager map_plugin_settings_t GetPluginSettings(const char *pName); }; -/** - * Loads settings and stores it in second parameter. On success it - * returns true, otherwise returns false. - * @param path A path of config file. - * @param settings A readed plugin's settings. - * @return if it success it returns true, otherwise it returns false. - */ -bool LoadPluginSettings(const char *pPath, - map_plugin_settings_t& pSettings); #endif /*PLUGINMANAGER_H_*/ |