From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIHdf-0003kD-78 for qemu-devel@nongnu.org; Thu, 23 Jul 2015 10:38:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIHdb-0006Ll-Rm for qemu-devel@nongnu.org; Thu, 23 Jul 2015 10:38:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIHdb-0006Lg-Mo for qemu-devel@nongnu.org; Thu, 23 Jul 2015 10:38:19 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 59B0235B944 for ; Thu, 23 Jul 2015 14:38:19 +0000 (UTC) References: <1437660098-4584-1-git-send-email-armbru@redhat.com> <1437660098-4584-2-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B0FC5A.9010906@redhat.com> Date: Thu, 23 Jul 2015 08:38:18 -0600 MIME-Version: 1.0 In-Reply-To: <1437660098-4584-2-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="L2ODfxS1HD7u9X03td6Tbf73eLrXkFlUF" Subject: Re: [Qemu-devel] [PATCH v2 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, lersek@redhat.com, dgilbert@redhat.com, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --L2ODfxS1HD7u9X03td6Tbf73eLrXkFlUF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/23/2015 08:01 AM, 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 > Reviewed-by: Eric Blake > --- > util/error.c | 70 ++++++++++++++++++++++------------------------------= -------- > 1 file changed, 26 insertions(+), 44 deletions(-) >=20 > if (os_errno !=3D 0) { > - err->msg =3D g_strdup_printf("%s: %s", msg1, strerror(os_errno= )); > - g_free(msg1); > - } else { > - err->msg =3D msg1; > + msg =3D (*errp)->msg; > + (*errp)->msg =3D g_strdup_printf("%s: %s", msg, strerror(os_er= rno)); Unrelated comment, so doesn't change R-b: strerror() is not required to be thread-safe, and can return NULL on error. Do we care? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --L2ODfxS1HD7u9X03td6Tbf73eLrXkFlUF 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/ iQEcBAEBCAAGBQJVsPxaAAoJEKeha0olJ0NqyN0IAI0smx6ceaOMtAVK+Lhi7tU5 Zfi+uGgffHXmgGDgtBwqVMLw97swjI3WlLNYNtz8NsW52e9oETzyQ3Y82WOTij7b LeRu1NN1YBztPCxP6Dq+kIthMyET6U6RItRQ5c/gStWGkBF6jJij7O8aD/KoEHGx IrtPyNS2w1g4CXXW6fnPbrkaKiRf6uVae+Uhx6x/qat0BVlR8ATcIez6BStVXJ2r 9I2zxXgsUKr8oy4drxbgwTDfTqk/Y7XSQMbGjWAw3CukGbKdMhFc8i0MPahLm3m9 H+AQoKt5DnAnkjCWtwtOZ8j277qjjx1cWlYvAmf9/gg95+9IawEWHoywrqaGSYs= =oKDY -----END PGP SIGNATURE----- --L2ODfxS1HD7u9X03td6Tbf73eLrXkFlUF--