From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z78nM-0005JD-LY for qemu-devel@nongnu.org; Mon, 22 Jun 2015 16:58:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z78nH-0000cK-JH for qemu-devel@nongnu.org; Mon, 22 Jun 2015 16:58:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z78nH-0000c2-2i for qemu-devel@nongnu.org; Mon, 22 Jun 2015 16:58:15 -0400 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 DCEDDA10D2 for ; Mon, 22 Jun 2015 20:58:13 +0000 (UTC) Message-ID: <558876E0.8000307@redhat.com> Date: Mon, 22 Jun 2015 14:58:08 -0600 From: Eric Blake MIME-Version: 1.0 References: <1435001200-20610-1-git-send-email-armbru@redhat.com> <1435001200-20610-2-git-send-email-armbru@redhat.com> In-Reply-To: <1435001200-20610-2-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hvwFvUm9Q5sDc8lOnP8GFr8fpbRFXvG2u" Subject: Re: [Qemu-devel] [PATCH 1/7] error: De-duplicate code creating Error objects List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, dgilbert@redhat.com, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hvwFvUm9Q5sDc8lOnP8GFr8fpbRFXvG2u Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/22/2015 01:26 PM, Markus Armbruster wrote: > Duplicated when commit 680d16d added error_set_errno(), and again when > commit 20840d4 added error_set_win32(). >=20 > Make the original copy in error_set() reusable by factoring out > error_setv(), then rewrite error_set_errno() and error_set_win32() on > top of it. >=20 > Signed-off-by: Markus Armbruster > --- > util/error.c | 69 ++++++++++++++++++++++------------------------------= -------- > 1 file changed, 25 insertions(+), 44 deletions(-) > @@ -96,37 +90,24 @@ void error_setg_file_open(Error **errp, int os_errn= o, const char *filename) > void error_set_win32(Error **errp, int win32_err, ErrorClass err_class= , > const char *fmt, ...) > { > if (win32_err !=3D 0) { > - char *msg2 =3D g_win32_error_message(win32_err); > - err->msg =3D g_strdup_printf("%s: %s (error: %x)", msg1, msg2,= > - (unsigned)win32_err); > + msg1 =3D (*errp)->msg; > + msg2 =3D g_win32_error_message(win32_err); > + (*errp)->msg =3D g_strdup_printf("%s: %s", msg1, msg2); Loses " (error: %x)". Do we care? I don't, except maybe in the commit message... Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hvwFvUm9Q5sDc8lOnP8GFr8fpbRFXvG2u 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/ iQEcBAEBCAAGBQJViHbgAAoJEKeha0olJ0NqaPEH/1tMq8RH0bY1dJfBlB3/V/zb Fs1/XAHBBrmTCkKJ5PVaPchAy1eTqKkPoAnGgmWNzYCTzX5P8oMwt2GXCi9pGFJz E121QIXbMRe8yPnntdsxhCYGBar08wA5hw7QvpLCDHgchORg8N7sRw5nWSIMvVRF hZnC1ujNUzCHtMunIHnzIL5+BoTVowoV3M7u2l1IYQr3MualSq3z9hNIh8c+LCDz Itsh8WxC/v7uTbHeQ9mUKdepD17JwHGhj6AvhmOnUMCRm7fJZpDvllF9vHQaVS70 MTUA1JBr4DypJeoALxPxYj5td9+fpQwSxeOVK4REj2hRQCmdrNKhNiIOfhGU2MU= =KhEo -----END PGP SIGNATURE----- --hvwFvUm9Q5sDc8lOnP8GFr8fpbRFXvG2u--