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/daemon/Daemon.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/daemon/Daemon.cpp')
-rw-r--r-- | src/daemon/Daemon.cpp | 106 |
1 files changed, 40 insertions, 66 deletions
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp index 62bcdc68..f98d8741 100644 --- a/src/daemon/Daemon.cpp +++ b/src/daemon/Daemon.cpp @@ -27,7 +27,6 @@ #include <sys/ioctl.h> /* ioctl(FIONREAD) */ #include <glib.h> #include "abrtlib.h" -#include "abrt_exception.h" #include "comm_layer_inner.h" #include "Settings.h" #include "CommLayerServerDBus.h" @@ -543,63 +542,49 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin char *fullname = NULL; crash_data_t *crash_data = NULL; - try + fullname = concat_path_file(DEBUG_DUMPS_DIR, name); + mw_result_t res = LoadDebugDump(fullname, &crash_data); + switch (res) { - fullname = concat_path_file(DEBUG_DUMPS_DIR, name); - mw_result_t res = LoadDebugDump(fullname, &crash_data); - switch (res) - { - case MW_OK: - log("New crash %s, processing", fullname); - /* Fall through */ + case MW_OK: + log("New crash %s, processing", fullname); + /* Fall through */ - case MW_OCCURRED: /* dup */ + case MW_OCCURRED: /* dup */ + { + if (res != MW_OK) { - if (res != MW_OK) - { - const char *first = get_crash_item_content_or_NULL(crash_data, CD_DUMPDIR); - log("Deleting crash %s (dup of %s), sending dbus signal", - strrchr(fullname, '/') + 1, - strrchr(first, '/') + 1); - delete_crash_dump_dir(fullname); - } - - const char *uid_str = get_crash_item_content_or_NULL(crash_data, FILENAME_UID); - const char *inform_all = get_crash_item_content_or_NULL(crash_data, FILENAME_INFORMALL); - - if (inform_all && string_to_bool(inform_all)) - uid_str = NULL; - char *crash_id = xasprintf("%s:%s", - get_crash_item_content_or_NULL(crash_data, FILENAME_UID), - get_crash_item_content_or_NULL(crash_data, FILENAME_UUID) - ); - /* Send dbus signal */ - g_pCommLayer->Crash(get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE), - crash_id, //TODO: stop passing this param, it is unused - fullname, - uid_str - ); - free(crash_id); - break; - } - case MW_CORRUPTED: - case MW_GPG_ERROR: - default: - log("Corrupted or bad crash %s (res:%d), deleting", fullname, (int)res); + const char *first = get_crash_item_content_or_NULL(crash_data, CD_DUMPDIR); + log("Deleting crash %s (dup of %s), sending dbus signal", + strrchr(fullname, '/') + 1, + strrchr(first, '/') + 1); delete_crash_dump_dir(fullname); - break; + } + + const char *uid_str = get_crash_item_content_or_NULL(crash_data, FILENAME_UID); + const char *inform_all = get_crash_item_content_or_NULL(crash_data, FILENAME_INFORMALL); + + if (inform_all && string_to_bool(inform_all)) + uid_str = NULL; + char *crash_id = xasprintf("%s:%s", + get_crash_item_content_or_NULL(crash_data, FILENAME_UID), + get_crash_item_content_or_NULL(crash_data, FILENAME_UUID) + ); + /* Send dbus signal */ + g_pCommLayer->Crash(get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE), + crash_id, //TODO: stop passing this param, it is unused + fullname, + uid_str + ); + free(crash_id); + break; } - } - catch (CABRTException& e) - { - error_msg("%s", e.what()); - } - catch (...) - { - free(fullname); - free(buf); - free_crash_data(crash_data); - throw; + case MW_CORRUPTED: + case MW_GPG_ERROR: + default: + log("Corrupted or bad crash %s (res:%d), deleting", fullname, (int)res); + delete_crash_dump_dir(fullname); + break; } free(fullname); free_crash_data(crash_data); @@ -899,19 +884,8 @@ int main(int argc, char** argv) s_signal_pipe_write = s_signal_pipe[1]; /* Enter the event loop */ - try - { - log("Init complete, entering main loop"); - run_main_loop(pMainloop); - } - catch (CABRTException& e) - { - error_msg("Error: %s", e.what()); - } - catch (std::exception& e) - { - error_msg("Error: %s", e.what()); - } + log("Init complete, entering main loop"); + run_main_loop(pMainloop); cleanup: /* Error or INT/TERM. Clean up, in reverse order. |