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/cli/dbus.cpp | |
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/cli/dbus.cpp')
-rw-r--r-- | src/cli/dbus.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cli/dbus.cpp b/src/cli/dbus.cpp index f9271b85..6c98ec4e 100644 --- a/src/cli/dbus.cpp +++ b/src/cli/dbus.cpp @@ -121,7 +121,7 @@ static DBusMessage* send_get_reply_and_unref(DBusMessage* msg) } } -vector_map_crash_data_t call_GetCrashInfos() +vector_of_crash_data_t *call_GetCrashInfos() { DBusMessage* msg = new_call_msg(__func__ + 5); DBusMessage *reply = send_get_reply_and_unref(msg); @@ -129,8 +129,8 @@ vector_map_crash_data_t call_GetCrashInfos() DBusMessageIter in_iter; dbus_message_iter_init(reply, &in_iter); - vector_map_crash_data_t argout; - int r = load_val(&in_iter, argout); + vector_of_crash_data_t *argout = NULL; + int r = load_vector_of_crash_data(&in_iter, &argout); if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5); @@ -138,7 +138,7 @@ vector_map_crash_data_t call_GetCrashInfos() return argout; } -map_crash_data_t call_CreateReport(const char* crash_id) +crash_data_t *call_CreateReport(const char* crash_id) { DBusMessage* msg = new_call_msg(__func__ + 5); dbus_message_append_args(msg, @@ -150,8 +150,8 @@ map_crash_data_t call_CreateReport(const char* crash_id) DBusMessageIter in_iter; dbus_message_iter_init(reply, &in_iter); - map_crash_data_t argout; - int r = load_val(&in_iter, argout); + crash_data_t *argout = NULL; + int r = load_crash_data(&in_iter, &argout); if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5); @@ -159,7 +159,7 @@ map_crash_data_t call_CreateReport(const char* crash_id) return argout; } -report_status_t call_Report(const map_crash_data_t& report, +report_status_t call_Report(crash_data_t *report, const vector_string_t& reporters, GHashTable *plugins) { @@ -168,7 +168,7 @@ report_status_t call_Report(const map_crash_data_t& report, dbus_message_iter_init_append(msg, &out_iter); /* parameter #1: report data */ - store_val(&out_iter, report); + store_crash_data(&out_iter, report); /* parameter #2: reporters to use */ store_val(&out_iter, reporters); /* parameter #3 (opt): plugin config */ |