From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axVl0-0000z5-Q1 for qemu-devel@nongnu.org; Tue, 03 May 2016 04:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axVkp-00035X-AP for qemu-devel@nongnu.org; Tue, 03 May 2016 04:32:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axVkp-0002yV-0T for qemu-devel@nongnu.org; Tue, 03 May 2016 04:32:27 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2BB9627F5 for ; Tue, 3 May 2016 08:32:15 +0000 (UTC) From: Markus Armbruster References: <1461903820-3092-1-git-send-email-eblake@redhat.com> <1461903820-3092-13-git-send-email-eblake@redhat.com> <87h9egk1gb.fsf@dusky.pond.sub.org> <57276EE6.7010507@redhat.com> Date: Tue, 03 May 2016 10:32:13 +0200 In-Reply-To: <57276EE6.7010507@redhat.com> (Eric Blake's message of "Mon, 2 May 2016 09:14:46 -0600") Message-ID: <87h9efa6eq.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 12/18] qapi: Add qobject_to_json_pretty_prefix() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: famz@redhat.com, qemu-devel@nongnu.org, Luiz Capitulino Eric Blake writes: > On 05/02/2016 07:56 AM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> The next patch will add pretty indentation to the JSON visitor. >>> But in order to support pretty output in the type_any() callback, >>> we need to prefix every line of the QObject visitor by the current >>> indentation in the JSON visitor. Hence, a new function >>> qobject_to_json_pretty_indent(), and the old function becomes a >>> thin wrapper to the expanded behavior. >>> > >>> QString *qobject_to_json(const QObject *obj); >>> QString *qobject_to_json_pretty(const QObject *obj); >>> +QString *qobject_to_json_pretty_prefix(const QObject *obj, const char *prefix); >> >> Why a string prefix, and not indentation? > > Might be possible. Would it be better as an integer for 'number of > spaces' or for 'number of indentation levels (where number of spaces per > indentation-level is not configurable)'? I'd go with indentation levels. The number of spaces per level is already an implementation detail of the pretty printer. Duplicating it outside of it is not a good idea.