diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-06 16:56:50 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-06 16:56:50 +0100 |
commit | 47728cc3c70c2b6d3a645e5760b39b20bd946e39 (patch) | |
tree | 6fd64dc8d124d5a10dd4efddd69a71f921f4a1d1 /src/applet | |
parent | 300a498bdc7b2912f8aaebeb87a7b4cc0a9970a5 (diff) | |
download | abrt-47728cc3c70c2b6d3a645e5760b39b20bd946e39.tar.gz abrt-47728cc3c70c2b6d3a645e5760b39b20bd946e39.tar.xz abrt-47728cc3c70c2b6d3a645e5760b39b20bd946e39.zip |
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 <dvlasenk@redhat.com>
Diffstat (limited to 'src/applet')
-rw-r--r-- | src/applet/test_report.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/applet/test_report.cpp b/src/applet/test_report.cpp index b93b6759..92a5d0af 100644 --- a/src/applet/test_report.cpp +++ b/src/applet/test_report.cpp @@ -34,12 +34,13 @@ static char *do_log(char *log_line, void *param) int main(int argc, char** argv) { - map_crash_data_t cd; + crash_data_t *crash_data = new_crash_data(); - add_to_crash_data(cd, "analyzer", "wow"); + add_to_crash_data(crash_data, "analyzer", "wow"); const char *event = "report"; - struct dump_dir *dd = create_crash_dump_dir(cd); + struct dump_dir *dd = create_crash_dump_dir(crash_data); + free_crash_data(crash_data); if (!dd) return 1; char *dir_name = strdup(dd->dd_dir); |