qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC v3 23/32] qapi: De-duplicate parameter list


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v3 23/32] qapi: De-duplicate parameter list generation
Date: Wed, 5 Aug 2015 11:00:29 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/04/2015 09:58 AM, Markus Armbruster wrote:
> Generated qapi-event.[ch] lose line breaks.  No change otherwise.
> 
> Signed-off-by: Markus Armbruster <address@hidden> --- 
> scripts/qapi-commands.py | 11 ++--------- scripts/qapi-event.py    |
> 18 +++--------------- scripts/qapi.py          | 16 ++++++++++++++++ 
> 3 files changed, 21 insertions(+), 24 deletions(-)
> 

> +++ b/scripts/qapi-event.py @@ -14,21 +14,9 @@ from qapi import *
> 
> def gen_event_send_proto(name, arg_type): -    api_name = "void
> qapi_event_send_%s(" % c_name(name).lower() -    l = len(api_name) - 
> -    if arg_type: -        for m in arg_type.members: -            if
> m.optional: -                api_name += "bool has_%s,\n" %
> c_name(m.name) -                api_name += "".ljust(l) - -
> api_name += "%s %s,\n" % (m.type.c_type(is_param=True), -
> c_name(m.name))

Converting from "" % (list) to...

> -            api_name += "".ljust(l) - -    api_name += "Error
> **errp)" -    return api_name +    return 'void
> qapi_event_send_%(c_name)s(%(param)s)' % { +        'c_name':
> c_name(name.lower()), +        'param': gen_params(arg_type, 'Error
> **errp')}

...direct "" % {dict}.  I hadn't seen that before in any of the qapi*.py
(I guess I'm too used to seeing mcgen() calls, where the dict is implied
via the **kwds magic). But since you don't want to call mcgen() on the
same input twice, it looks correct.

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]