From 47728cc3c70c2b6d3a645e5760b39b20bd946e39 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 6 Dec 2010 16:56:50 +0100 Subject: This patch changes crash data to use C structures. The smallest data element is: struct crash_item { char *content; unsigned flags; }; where content is, eh, content, and flags is a bit flag field. crash_data_t is a map of crash_item's, implemented as a pointer to heap-allocated GHashTable. vector_of_crash_data_t is a vector of crash_data_t's, implemented as a pointer to heap-allocated GPtrArray. Most operations have light wrappers around them to hide the nature of the containers. For example, to free vector_of_crash_data, you need to use free_vector_of_crash_data(ptr) instead of open-coding g_ptr_array_free. The wrapper is thin. The goal is not so much to hide the implementation, but more to make it easier to use the correct function. dbus (un)marshalling functions convert crash_item to three-element array of strings, in order to keep compatibility with abrt-gui (python). This can be changed later to use native representation. crash_data_t and vector_of_crash_data_t are represented in "natural" way, no funny stuff there. Signed-off-by: Denys Vlasenko --- src/plugins/abrt-action-kerneloops.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/abrt-action-kerneloops.cpp') diff --git a/src/plugins/abrt-action-kerneloops.cpp b/src/plugins/abrt-action-kerneloops.cpp index dea6df17..ac90abd7 100644 --- a/src/plugins/abrt-action-kerneloops.cpp +++ b/src/plugins/abrt-action-kerneloops.cpp @@ -91,11 +91,10 @@ static void report_to_kerneloops( if (!dd) exit(1); /* error msg is already logged */ - map_crash_data_t pCrashData; - load_crash_data_from_crash_dump_dir(dd, pCrashData); + crash_data_t *crash_data = load_crash_data_from_crash_dump_dir(dd); dd_close(dd); - const char *backtrace = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_BACKTRACE); + const char *backtrace = get_crash_item_content_or_NULL(crash_data, FILENAME_BACKTRACE); if (!backtrace) error_msg_and_die("Error sending kernel oops due to missing backtrace"); @@ -114,6 +113,8 @@ static void report_to_kerneloops( if (ret != CURLE_OK) error_msg_and_die("Kernel oops has not been sent due to %s", curl_easy_strerror(ret)); + free_crash_data(crash_data); + /* Server replies with: * 200 thank you for submitting the kernel oops information * RemoteIP: 34192fd15e34bf60fac6a5f01bba04ddbd3f0558 -- cgit