On 04/26/2018 11:53 AM, Ian Jackson wrote:
> This patch is the result of
> 
>   git-grep -l 'error_report.*strerror' | xargs perl -p -i~ ../t
> 
> with ../t containing
> 
>   s{error_report\("(.*): \%s"(, .*)?, 
> strerror\(errno\)\)\;}{error_report_errno\("$1"$2)\;}
> 
> Since this is an automatically generated patch, it does not contain
> any cleanups of the occasional idiosyncratic messages.  That is left
> to the future.
> 
> No functional change, since error_report_errno does exactly what this
> previous open-coded pattern does.
> 
> Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
> ---
>  audio/wavcapture.c       |  2 +-
>  hw/i386/xen/xen-hvm.c    |  2 +-
>  hw/tpm/tpm_emulator.c    |  2 +-
>  hw/xen/xen_pt_load_rom.c |  4 ++--
>  migration/postcopy-ram.c | 12 ++++++------
>  net/tap-linux.c          |  2 +-
>  os-posix.c               |  8 ++++----
>  qemu-nbd.c               |  4 ++--
>  scsi/qemu-pr-helper.c    |  4 ++--
>  slirp/misc.c             |  4 ++--
>  util/osdep.c             |  2 +-
>  vl.c                     |  6 +++---
>  12 files changed, 26 insertions(+), 26 deletions(-)

See my other emails about whether this should be
error_report_errno(errno, "...").

Misses a lot of two-line instances, such as:
$ git grep -A1 error_report | grep -C1 strerror.errno
...
block/file-posix.c:            error_report("Failed to restore old file
length:
%s",
block/file-posix.c-                         strerror(errno));
...

If we're going to clean up these instances, we might as well look harder
for them.  Can Coccinelle be coaxed into helping us (at least for
identifying callsites, even if I can't figure out how to make it
slice-and-dice format strings)?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to