Received: from eggs.gnu.org ([2001:4830:134:3::10]:48527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8pmJ-0002qO-9r for qemu-devel@nongnu.org; Fri, 03 Jun 2016 10:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8pmG-0007X5-0I for qemu-devel@nongnu.org; Fri, 03 Jun 2016 10:08:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8pmF-0007X0-Qc for qemu-devel@nongnu.org; Fri, 03 Jun 2016 10:08:43 -0400 From: Markus Armbruster References: <1463632874-28559-1-git-send-email-eblake@redhat.com> <1463632874-28559-26-git-send-email-eblake@redhat.com> <87shwu66zk.fsf@dusky.pond.sub.org> <57517E46.3090104@redhat.com> Date: Fri, 03 Jun 2016 16:08:41 +0200 In-Reply-To: <57517E46.3090104@redhat.com> (Eric Blake's message of "Fri, 3 Jun 2016 06:55:34 -0600") Message-ID: <87a8j2uzyu.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 25/28] qapi: Support pretty printing in JSON output visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth Eric Blake writes: > On 06/03/2016 01:56 AM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> Similar to pretty printing in the QObject visitor. The trickiest >>> part is probably that the testsuite now has to honor parameterization >>> on whether pretty printing is enabled. >> >> Worth mentioning that the pretty-printing matches the one in >> qobject-json.c? > > Yes, particularly since we later rely on that fact to rewrite > qobject-json.c on top of the JSON visitor :) > > >>> static void visitor_output_setup(TestOutputVisitorData *data, >>> - const void *unused) >>> + const void *arg) >>> { >>> - data->ov = json_output_visitor_new(&data->str); >>> + const bool *pretty = arg; >> >> Could do bool pretty = *(bool *)arg. Matter of taste. Same elsewhere. > > Requires a cast. I like avoiding casts where C lets us do so. But I > also agree that *pretty looks ugly, so maybe: > > ...(const void *arg) > { > const bool *data; > bool pretty = *data; Fewer casts are generally better, but so are fewer variables. Pick a solution you like. The one you chose for this patch is acceptable.