[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/16] error-report: simplify print_loc()
From: |
marcandre . lureau |
Subject: |
[PATCH v3 03/16] error-report: simplify print_loc() |
Date: |
Wed, 10 Aug 2022 16:48:44 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Pass the program name as "prefix" argument to print_loc() if printing
with "details". This allows to get rid of monitor_cur() call in
print_loc().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
util/error-report.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/util/error-report.c b/util/error-report.c
index 893da10f19..c43227a975 100644
--- a/util/error-report.c
+++ b/util/error-report.c
@@ -138,14 +138,14 @@ void loc_set_file(const char *fname, int lno)
/*
* Print current location to current monitor if we have one, else to stderr.
*/
-static void print_loc(void)
+static void print_loc(const char *prefix)
{
const char *sep = "";
int i;
const char *const *argp;
- if (!monitor_cur() && g_get_prgname()) {
- error_printf("%s:", g_get_prgname());
+ if (prefix) {
+ error_printf("%s:", prefix);
sep = " ";
}
switch (cur_loc->kind) {
@@ -209,7 +209,7 @@ static void vreport(report_type type, const char *fmt,
va_list ap)
error_printf("%s ", error_guest_name);
}
- print_loc();
+ print_loc(detailed ? g_get_prgname() : NULL);
switch (type) {
case REPORT_TYPE_ERROR:
--
2.37.1
- [PATCH v3 00/16] Preliminary patches for subproject split, marcandre . lureau, 2022/08/10
- [PATCH v3 01/16] error-report: misc comment fix, marcandre . lureau, 2022/08/10
- [PATCH v3 02/16] error-report: introduce "detailed" variable, marcandre . lureau, 2022/08/10
- [PATCH v3 03/16] error-report: simplify print_loc(),
marcandre . lureau <=
- [PATCH v3 04/16] error-report: introduce overridable error_is_detailed(), marcandre . lureau, 2022/08/10
- [PATCH v3 05/16] stubs: remove needless error_vprintf_unless_qmp(), marcandre . lureau, 2022/08/10
- [PATCH v3 06/16] qapi: move QEMU-specific dispatch code in monitor, marcandre . lureau, 2022/08/10
- [PATCH v3 07/16] qapi: remove QEMU-specific monitor dependency from dispatch, marcandre . lureau, 2022/08/10
- [PATCH v3 08/16] scripts/qapi-gen: add -i option, marcandre . lureau, 2022/08/10
- [PATCH v3 13/16] qemu-common: move glib-compat.h, marcandre . lureau, 2022/08/10
- [PATCH v3 16/16] qemu-common: add error-report test, marcandre . lureau, 2022/08/10
- [PATCH v3 12/16] qemu-common: move scripts/qapi, marcandre . lureau, 2022/08/10
- [PATCH v3 14/16] qemu-common: move error-report, marcandre . lureau, 2022/08/10
- [PATCH v3 15/16] mtest2make.py: teach suite name that are just "PROJECT", marcandre . lureau, 2022/08/10