qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, lersek@redhat.com, dgilbert@redhat.com,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/7] error: De-duplicate code creating Error objects
Date: Thu, 23 Jul 2015 08:38:18 -0600	[thread overview]
Message-ID: <55B0FC5A.9010906@redhat.com> (raw)
In-Reply-To: <1437660098-4584-2-git-send-email-armbru@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

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().
> 
> 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 <armbru@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  util/error.c | 70 ++++++++++++++++++++++--------------------------------------
>  1 file changed, 26 insertions(+), 44 deletions(-)
> 

>      if (os_errno != 0) {
> -        err->msg = g_strdup_printf("%s: %s", msg1, strerror(os_errno));
> -        g_free(msg1);
> -    } else {
> -        err->msg = msg1;
> +        msg = (*errp)->msg;
> +        (*errp)->msg = g_strdup_printf("%s: %s", msg, strerror(os_errno));

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?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-07-23 14:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 14:01 [Qemu-devel] [PATCH v2 0/7] error: On abort, report where the error was created Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 1/7] error: De-duplicate code creating Error objects Markus Armbruster
2015-07-23 14:38   ` Eric Blake [this message]
2015-07-24  8:59     ` Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 2/7] error: Make error_setg() a function Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 3/7] qga: Clean up unnecessarily dirty casts Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 4/7] qga/vss-win32: Document the DLL requires non-null errp Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 5/7] error: error_set_errno() is unused, drop Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 6/7] error: Revamp interface documentation Markus Armbruster
2015-07-28 11:31   ` Dr. David Alan Gilbert
2015-07-29  7:23     ` Markus Armbruster
2015-07-29 18:32       ` Dr. David Alan Gilbert
2015-07-30  6:58         ` Markus Armbruster
2015-07-23 14:01 ` [Qemu-devel] [PATCH v2 7/7] error: On abort, report where the error was created Markus Armbruster
2015-07-23 14:47   ` Eric Blake
2015-07-24  8:14     ` Laszlo Ersek
2015-07-24  9:02     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B0FC5A.9010906@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).