From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9apZ-0004j2-8a for qemu-devel@nongnu.org; Thu, 17 Dec 2015 10:51:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9apW-00088T-0K for qemu-devel@nongnu.org; Thu, 17 Dec 2015 10:51:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9apV-00087v-Of for qemu-devel@nongnu.org; Thu, 17 Dec 2015 10:50:57 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 3880533A8B6 for ; Thu, 17 Dec 2015 15:50:57 +0000 (UTC) References: <1450354795-31608-1-git-send-email-armbru@redhat.com> <1450354795-31608-7-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <5672D9DC.10203@redhat.com> Date: Thu, 17 Dec 2015 08:50:52 -0700 MIME-Version: 1.0 In-Reply-To: <1450354795-31608-7-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H38fefSPLP2lIcepqatskl6pM4qdUhB5X" Subject: Re: [Qemu-devel] [PATCH v2 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: Markus Armbruster , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --H38fefSPLP2lIcepqatskl6pM4qdUhB5X Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/17/2015 05:19 AM, Markus Armbruster wrote: > 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. >=20 > Change error_report_err() to print just the hint, and the (still few) > users of error_append_hint() to add the required newline. >=20 > Cc: Eric Blake > Signed-off-by: Markus Armbruster > --- > qdev-monitor.c | 2 ++ > util/error.c | 2 +- > util/qemu-option.c | 4 ++-- > 3 files changed, 5 insertions(+), 3 deletions(-) Would also be worth squashing this in: diff --git i/include/qapi/error.h w/include/qapi/error.h index 1480f59..007dc94 100644 --- i/include/qapi/error.h +++ w/include/qapi/error.h @@ -142,6 +142,8 @@ ErrorClass error_get_class(const Error *err); * If @errp is anything else, *@errp must be NULL. * The new error's class is ERROR_CLASS_GENERIC_ERROR, and its * human-readable error message is made from printf-style @fmt, ... + * @fmt should be limited to one line, and should not include trailing + * punctuation or newline (to provide more text, see error_append_hint()= ). */ #define error_setg(errp, fmt, ...) \ error_setg_internal((errp), __FILE__, __LINE__, __func__, \ @@ -198,7 +200,8 @@ void error_propagate(Error **dst_errp, Error *local_err); /** * Append a printf-style human-readable explanation to an existing error= =2E - * May be called multiple times, and safe if @errp is NULL. + * May be called multiple times, and safe if @errp is NULL. Caller is + * responsible for providing a trailing newline when the hint is complet= e. */ void error_append_hint(Error **errp, const char *fmt, ...) GCC_FMT_ATTR(2, 3); Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --H38fefSPLP2lIcepqatskl6pM4qdUhB5X Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWctncAAoJEKeha0olJ0NqLRUH/3oXAw0ujHavthg7J0T8ujz2 m5EG2TdsG8g8nqs32ylUf//o5+dPlu4igyPivp6fEViI+PxkJcTdFOM/2YMtc8Cu znhgjZxtqAdE/ZoZNYLFLwfxzzNxTCJumM0MYObC+bdEl4fY7CdUQ+pBzDSRTjZs QoHFYYIXMmGMCFPSCgL/0R9T7cC4GRKmvV1RyOkJXRMQYRJMcxAbFdVMm6leKWHU wrknkBC3WoyJw2bIBV/vz5+DRy+gUSCAye/zZ0EAcnZs9OqV03kkLRnfrUf8ZHdU 7xPN4eyM5b/j0OVKjdZfN/l0Tml1k1BfaRo/UJLCEoXa7Psf21/7ASBa0RZmUdE= =rr8i -----END PGP SIGNATURE----- --H38fefSPLP2lIcepqatskl6pM4qdUhB5X--