qapi-commands: Inline single-use helpers of gen_marshal()
authorEric Blake <eblake@redhat.com>
Thu, 17 Mar 2016 22:48:34 +0000 (16:48 -0600)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 18 Mar 2016 09:29:26 +0000 (10:29 +0100)
commitc1ff0e6c853111496a3c5ae392b9adae5043c7be
tree6fc06cb594f105e7c58a721d12849afc143fec28
parent386230a249ca6ed0204d8616dfc30c5ea95a809c
qapi-commands: Inline single-use helpers of gen_marshal()

Originally, gen_marshal_input_visit() (or gen_visitor_input_block()
before commit f1538019) was factored out to make it easy to do two
passes of a visit to each member of a (possibly-implicit) object,
without duplicating lots of code.  But after recent changes, those
visits now occupy a single line of emitted code, and the helper
method has become a series of conditionals both before and after
the one important line, making it rather awkward to see at a glance
what gets emitted on the first (parsing) or second (deallocation)
pass.  It's a lot easier to read the generator code if we just
inline both uses directly into gen_marshal(), without all the
conditionals.

Once we've done that, it's easy to notice that gen_marshal_vars()
is used only once, and inlining it too lets us consolidate some
mcgen() calls that used to be split across helpers.

gen_call() remains a single-use helper function, but it has
enough indentation and complexity that inlining it would hamper
legibility.

No change to generated output.  The fact that the diffstat shows
a net reduction in lines is an argument in favor of this cleanup.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1458254921-17042-10-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi-commands.py