diff options
author | Karel Klic <kklic@redhat.com> | 2009-10-21 14:55:32 +0200 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2009-10-21 14:55:32 +0200 |
commit | c5cbf4ac39edb168810eb94a55c3282aa30b0620 (patch) | |
tree | 357586a45c55050c77abb96a3d280ae29509ca71 /src | |
parent | 321a278ea5b1e5defd6e4dd35a108c0838fc8f98 (diff) | |
download | abrt-c5cbf4ac39edb168810eb94a55c3282aa30b0620.tar.gz abrt-c5cbf4ac39edb168810eb94a55c3282aa30b0620.tar.xz abrt-c5cbf4ac39edb168810eb94a55c3282aa30b0620.zip |
Use defines instead of strings where possible.
Diffstat (limited to 'src')
-rw-r--r-- | src/CLI/report.cpp | 46 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.cpp | 2 |
2 files changed, 25 insertions, 23 deletions
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp index b9c6d414..8dedf036 100644 --- a/src/CLI/report.cpp +++ b/src/CLI/report.cpp @@ -19,6 +19,7 @@ #include "run-command.h" #include "dbus.h" #include "abrtlib.h" +#include "DebugDump.h" // FILENAME_* defines #if HAVE_CONFIG_H #include <config.h> #endif @@ -159,7 +160,8 @@ static void write_crash_report_field(FILE *fp, const map_crash_report_t &report, const map_crash_report_t::const_iterator it = report.find(field); if (it == report.end()) { - error_msg("Field %s not found.\n", field); + // exit silently, all fields are optional for now + //error_msg("Field %s not found.\n", field); return; } @@ -192,22 +194,22 @@ static int write_crash_report(const map_crash_report_t &report, FILE *fp) fprintf(fp, "# Please check this report. Lines starting with '#' will be ignored.\n" "# Lines starting with '%%----' separate fields, please do not delete them.\n\n"); - write_crash_report_field(fp, report, "Comment", + write_crash_report_field(fp, report, CD_COMMENT, _("# Describe the circumstances of this crash below.")); - write_crash_report_field(fp, report, "How to reproduce", + write_crash_report_field(fp, report, CD_REPRODUCE, _("# How to reproduce the crash?")); write_crash_report_field(fp, report, "backtrace", _("# Stack trace: a list of active stack frames at the time the crash occurred\n# Check that it does not contain any sensitive data such as passwords.")); - write_crash_report_field(fp, report, "UUID", _("# UUID")); - write_crash_report_field(fp, report, "architecture", _("# Architecture")); + write_crash_report_field(fp, report, CD_UUID, _("# UUID")); + write_crash_report_field(fp, report, FILENAME_ARCHITECTURE, _("# Architecture")); write_crash_report_field(fp, report, "cmdline", _("# Command line")); - write_crash_report_field(fp, report, "component", _("# Component")); + write_crash_report_field(fp, report, FILENAME_COMPONENT, _("# Component")); write_crash_report_field(fp, report, "coredump", _("# Core dump")); - write_crash_report_field(fp, report, "executable", _("# Executable")); - write_crash_report_field(fp, report, "kernel", _("# Kernel version")); - write_crash_report_field(fp, report, "package", _("# Package")); - write_crash_report_field(fp, report, "reason", _("# Reason of crash")); - write_crash_report_field(fp, report, "release", _("# Release string of the operating system")); + write_crash_report_field(fp, report, FILENAME_EXECUTABLE, _("# Executable")); + write_crash_report_field(fp, report, FILENAME_KERNEL, _("# Kernel version")); + write_crash_report_field(fp, report, FILENAME_PACKAGE, _("# Package")); + write_crash_report_field(fp, report, FILENAME_REASON, _("# Reason of crash")); + write_crash_report_field(fp, report, FILENAME_RELEASE, _("# Release string of the operating system")); return 0; } @@ -227,7 +229,7 @@ static int read_crash_report_field(const char *text, map_crash_report_t &report, sprintf(separator, "\n%s%s\n", FIELD_SEP, field); const char *textfield = strstr(text, separator); if (!textfield) - return 0; + return 0; // exit silently because all fields are optional textfield += strlen(separator); int length = 0; @@ -284,19 +286,19 @@ static int read_crash_report_field(const char *text, map_crash_report_t &report, static int read_crash_report(map_crash_report_t &report, const char *text) { int result = 0; - result |= read_crash_report_field(text, report, "Comment"); - result |= read_crash_report_field(text, report, "How to reproduce"); + result |= read_crash_report_field(text, report, CD_COMMENT); + result |= read_crash_report_field(text, report, CD_REPRODUCE); result |= read_crash_report_field(text, report, "backtrace"); - result |= read_crash_report_field(text, report, "UUID"); - result |= read_crash_report_field(text, report, "architecture"); + result |= read_crash_report_field(text, report, CD_UUID); + result |= read_crash_report_field(text, report, FILENAME_ARCHITECTURE); result |= read_crash_report_field(text, report, "cmdline"); - result |= read_crash_report_field(text, report, "component"); + result |= read_crash_report_field(text, report, FILENAME_COMPONENT); result |= read_crash_report_field(text, report, "coredump"); - result |= read_crash_report_field(text, report, "executable"); - result |= read_crash_report_field(text, report, "kernel"); - result |= read_crash_report_field(text, report, "package"); - result |= read_crash_report_field(text, report, "reason"); - result |= read_crash_report_field(text, report, "release"); + result |= read_crash_report_field(text, report, FILENAME_EXECUTABLE); + result |= read_crash_report_field(text, report, FILENAME_KERNEL); + result |= read_crash_report_field(text, report, FILENAME_PACKAGE); + result |= read_crash_report_field(text, report, FILENAME_REASON); + result |= read_crash_report_field(text, report, FILENAME_RELEASE); return result; } diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 05abc9b5..9060d79a 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -499,7 +499,7 @@ void LoadOpenGPGPublicKey(const char* key) * @return It return results of operation. See mw_result_t. */ static mw_result_t SavePackageDescriptionToDebugDump(const std::string& pExecutable, - const std::string& pDebugDumpDir) + const std::string& pDebugDumpDir) { std::string package; std::string packageName; |