Received: from eggs.gnu.org ([2001:4830:134:3::10]:57229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9rB4-0006jy-7a for qemu-devel@nongnu.org; Fri, 18 Dec 2015 04:18:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9rB0-0003Wz-UJ for qemu-devel@nongnu.org; Fri, 18 Dec 2015 04:18:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9rB0-0003Wn-Oy for qemu-devel@nongnu.org; Fri, 18 Dec 2015 04:18:14 -0500 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 30E428E395 for ; Fri, 18 Dec 2015 09:18:14 +0000 (UTC) From: Markus Armbruster References: <1450371004-26866-1-git-send-email-armbru@redhat.com> <1450371004-26866-12-git-send-email-armbru@redhat.com> <56731D65.9050703@redhat.com> Date: Fri, 18 Dec 2015 10:18:11 +0100 In-Reply-To: <56731D65.9050703@redhat.com> (Eric Blake's message of "Thu, 17 Dec 2015 13:39:01 -0700") Message-ID: <87zix8i08c.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 11/23] error: Use error_reportf_err() where it makes obvious sense List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org Eric Blake writes: > On 12/17/2015 09:49 AM, Markus Armbruster wrote: >> Done with this Coccinelle semantic patch >> >> @@ >> expression FMT, E; >> expression list ARGS; >> @@ >> - error_report(FMT, ARGS, error_get_pretty(E)); >> + error_reportf_err(E, FMT/*@@@*/, ARGS); >> ( >> - error_free(E); >> | >> exit(S); > > Does S have to be declared an expression, for this branch to work > correctly? I guess not, since... Pasto, fixed. >> | >> abort(); >> ) >> >> followed by a replace of '%s"/*@@@*/' by '"' and some line rewrapping, >> because I can't figure out how to make Coccinelle transform strings. >> > > Hey - you can already make it do more than I can. > > >> Signed-off-by: Markus Armbruster >> --- >> +++ b/arch_init.c >> @@ -258,9 +258,7 @@ void do_acpitable_option(const QemuOpts *opts) >> >> acpi_table_add(opts, &err); >> if (err) { >> - error_report("Wrong acpi table provided: %s", >> - error_get_pretty(err)); >> - error_free(err); >> + error_reportf_err(err, "Wrong acpi table provided: "); >> exit(1); > > ...you properly found this spot. > >> +++ b/blockdev.c >> @@ -1583,13 +1583,10 @@ static void >> internal_snapshot_abort(BlkActionState *common) >> } >> >> if (bdrv_snapshot_delete(bs, sn->id_str, sn->name, &local_error) < 0) { >> - error_report("Failed to delete snapshot with id '%s' and name '%s' >> on " >> - "device '%s' in abort: %s", >> - sn->id_str, >> - sn->name, >> - bdrv_get_device_name(bs), >> - error_get_pretty(local_error)); >> - error_free(local_error); >> + error_reportf_err(local_error, >> + "Failed to delete snapshot with id '%s' and name '%s' on " "device >> '%s' in abort: ", > > Whoops; line rewrapping touchups missed here. > > With that fixed, > Reviewed-by: Eric Blake Thanks!