diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-08 14:51:47 +0100 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-08 14:51:47 +0100 |
| commit | 816f3e001271ed8ab7fdadb6d90aeb2c61362dac (patch) | |
| tree | a7e453859a80fb47c7c74cb37791e35ad50f1d97 /src/plugins/abrt-action-upload.cpp | |
| parent | 3a9554929de070297a0e816eb2839291335a9403 (diff) | |
| download | abrt-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/plugins/abrt-action-upload.cpp')
| -rw-r--r-- | src/plugins/abrt-action-upload.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/plugins/abrt-action-upload.cpp b/src/plugins/abrt-action-upload.cpp index 9741f543..8789f0e7 100644 --- a/src/plugins/abrt-action-upload.cpp +++ b/src/plugins/abrt-action-upload.cpp @@ -22,7 +22,6 @@ #include "abrtlib.h" #include "parse_options.h" #include "abrt_crash_dump.h" -#include "abrt_exception.h" #define PROGNAME "abrt-action-upload" @@ -104,7 +103,7 @@ static int send_file(const char *url, const char *filename) static int create_and_upload_archive( const char *dump_dir_name, - const map_plugin_settings_t& settings) + map_string_h *settings) { int result = 0; @@ -125,12 +124,8 @@ static int create_and_upload_archive( //ArchiveType = .tar.bz2 //ExcludeFiles = foo,bar*,b*z char* env; - map_plugin_settings_t::const_iterator end = settings.end(); - map_plugin_settings_t::const_iterator it; - env = getenv("Upload_URL"); - it = settings.find("URL"); - const char *url = (env ? env : (it == end ? NULL : it->second.c_str())); + const char *url = (env ? env : get_map_string_item_or_empty(settings, "URL")); /* Create a child gzip which will compress the data */ /* SELinux guys are not happy with /tmp, using /var/run/abrt */ @@ -279,21 +274,14 @@ int main(int argc, char **argv) // logmode = LOGMODE_SYSLOG; //} - map_plugin_settings_t settings; + map_string_h *settings = new_map_string(); if (url) - settings["URL"] = url; + g_hash_table_replace(settings, xstrdup("URL"), xstrdup(url)); if (conf_file) - LoadPluginSettings(conf_file, settings); + load_conf_file(conf_file, settings, /*skip key w/o values:*/ true); - int result = 0; - try - { - result = create_and_upload_archive(dump_dir_name, settings); - } - catch (CABRTException& e) - { - error_msg_and_die("%s", e.what()); - } + int result = create_and_upload_archive(dump_dir_name, settings); + free_map_string(settings); return result; } |
