On Fri, 2011-07-22 at 13:37 +0200, Miroslav Lichvar wrote:
src/plugins/reporter-bugzilla.c | 7 ++++++- src/plugins/reporter-kerneloops.c | 7 ++++++- src/plugins/reporter-mailx.c | 7 ++++++- src/plugins/reporter-print.c | 7 ++++++- src/plugins/reporter-rhtsupport.c | 7 ++++++- 5 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c index 99b03e7..5b58a29 100644 --- a/src/plugins/reporter-bugzilla.c +++ b/src/plugins/reporter-bugzilla.c @@ -207,7 +207,12 @@ static void report_to_bugzilla(const char *dump_dir_name, map_string_h *settings struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (dd) {
char *msg = xasprintf("Bugzilla: URL=%s/show_bug.cgi?id=%u", bugzilla_url, bz->bi_id);
struct report_result *res;
char *msg = xasprintf("%s/show_bug.cgi?id=%u", bugzilla_url, bz->bi_id);
res = new_report_result(REPORT_RESULT_TYPE_URL, msg);
msg = format_report_result(res);
free_report_result(res);
This looks like a step back to me, not a progress. Instead of one line of code, now you need five.
Intermediate "struct report_result" object is not really needed.
How about a custom result formatting function which simply returns char*?
if (dd) {
char *msg = xasprintf("kerneloops: URL=%s", submitURL);
struct report_result *res;
char *msg = xasprintf("%s", submitURL);
res = new_report_result(REPORT_RESULT_TYPE_URL, msg);
msg = format_report_result(res);
free_report_result(res);
Same.
if (dd) {
char *msg = xasprintf("email: %s", email_to);
struct report_result *res;
char *msg = xasprintf("mailto:%s", email_to);
res = new_report_result(REPORT_RESULT_TYPE_URL, msg);
msg = format_report_result(res);
free_report_result(res);
Same.
if (dd) {
char *msg = xasprintf("file: %s", output_file);
struct report_result *res;
char *msg = xasprintf("file://%s", output_file);;
res = new_report_result(REPORT_RESULT_TYPE_URL, msg);
msg = format_report_result(res);
free_report_result(res); add_reported_to(dd, msg);
Same.
free(msg); dd_close(dd);
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c index 4f6d2b6..eade3ee 100644 --- a/src/plugins/reporter-rhtsupport.c +++ b/src/plugins/reporter-rhtsupport.c @@ -243,7 +243,12 @@ static void report_to_rhtsupport( struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (dd) {
char *msg = xasprintf("RHTSupport: %s", result);
struct report_result *res;
char *msg = xasprintf("%s", result);
res = new_report_result(REPORT_RESULT_TYPE_MESSAGE, msg);
msg = format_report_result(res);
free_report_result(res);
Same.