Received: from eggs.gnu.org ([2001:4830:134:3::10]:43226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7I8v-0003Ha-SU for qemu-devel@nongnu.org; Tue, 23 Jun 2015 02:57:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7I8q-00048M-SQ for qemu-devel@nongnu.org; Tue, 23 Jun 2015 02:57:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7I8q-00048I-ND for qemu-devel@nongnu.org; Tue, 23 Jun 2015 02:57:08 -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 4A8B15A097 for ; Tue, 23 Jun 2015 06:57:08 +0000 (UTC) From: Markus Armbruster References: <1435001200-20610-1-git-send-email-armbru@redhat.com> <1435001200-20610-2-git-send-email-armbru@redhat.com> <558876E0.8000307@redhat.com> Date: Tue, 23 Jun 2015 08:57:05 +0200 In-Reply-To: <558876E0.8000307@redhat.com> (Eric Blake's message of "Mon, 22 Jun 2015 14:58:08 -0600") Message-ID: <878uba29q6.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Eric Blake Cc: pbonzini@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com Eric Blake writes: > 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(). >> >> 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. >> >> 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_errno, const char *filename) >> void error_set_win32(Error **errp, int win32_err, ErrorClass err_class, >> const char *fmt, ...) >> { > >> if (win32_err != 0) { >> - char *msg2 = g_win32_error_message(win32_err); >> - err->msg = g_strdup_printf("%s: %s (error: %x)", msg1, msg2, >> - (unsigned)win32_err); >> + msg1 = (*errp)->msg; >> + msg2 = g_win32_error_message(win32_err); >> + (*errp)->msg = g_strdup_printf("%s: %s", msg1, msg2); > > Loses " (error: %x)". Do we care? I don't, except maybe in the commit > message... Unintentional, I'll put it right back. (I don't care either, but dropping it deserves its own commit) > Reviewed-by: Eric Blake Thanks!