From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bWb-00079U-4x for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:35:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9bWY-0003s5-TD for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:35:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bWY-0003rp-Nc for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:35:26 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 521653407F5 for ; Thu, 17 Dec 2015 16:35:26 +0000 (UTC) From: Markus Armbruster Date: Thu, 17 Dec 2015 17:35:14 +0100 Message-Id: <1450370121-5768-7-git-send-email-armbru@redhat.com> In-Reply-To: <1450370121-5768-1-git-send-email-armbru@redhat.com> References: <1450370121-5768-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 06/13] error: Don't append a newline when printing the error hint List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Since commit 50b7b00, we have error_append_hint() to conveniently accumulate Error member @hint. error_report_err() prints it with a newline appended. Consequently, users of error_append_hint() need to know whether theirs is the final line of the hint to decide whether it needs a newline. Not a nice interface. Change error_report_err() to print just the hint, and the (still few) users of error_append_hint() to add the required newline. Cc: Eric Blake Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- qdev-monitor.c | 2 ++ util/error.c | 2 +- util/qemu-option.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/qdev-monitor.c b/qdev-monitor.c index a35098f..30936df 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -304,6 +304,7 @@ static void qbus_list_bus(DeviceState *dev, Error **errp) error_append_hint(errp, "%s\"%s\"", sep, child->name); sep = ", "; } + error_append_hint(errp, "\n"); } static void qbus_list_dev(BusState *bus, Error **errp) @@ -321,6 +322,7 @@ static void qbus_list_dev(BusState *bus, Error **errp) } sep = ", "; } + error_append_hint(errp, "\n"); } static BusState *qbus_find_bus(DeviceState *dev, char *elem) diff --git a/util/error.c b/util/error.c index 80c89a2..9b27c45 100644 --- a/util/error.c +++ b/util/error.c @@ -204,7 +204,7 @@ void error_report_err(Error *err) { error_report("%s", error_get_pretty(err)); if (err->hint) { - error_printf_unless_qmp("%s\n", err->hint->str); + error_printf_unless_qmp("%s", err->hint->str); } error_free(err); } diff --git a/util/qemu-option.c b/util/qemu-option.c index a50ecea..a2d593a 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -206,7 +206,7 @@ void parse_option_size(const char *name, const char *value, default: error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size"); error_append_hint(errp, "You may use k, M, G or T suffixes for " - "kilobytes, megabytes, gigabytes and terabytes."); + "kilobytes, megabytes, gigabytes and terabytes.\n"); return; } } else { @@ -647,7 +647,7 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "id", "an identifier"); error_append_hint(errp, "Identifiers consist of letters, digits, " - "'-', '.', '_', starting with a letter."); + "'-', '.', '_', starting with a letter.\n"); return NULL; } opts = qemu_opts_find(list, id); -- 2.4.3