Re: [PATCH 02/33] codegen: Simplify if/else blocks

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

 



On Wed, Jul 01, 2015 at 06:09:54PM +0100, Frediano Ziglio wrote:
> Blocks was mainly the same, reduce code.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  python_modules/marshal.py | 29 +++++++++++------------------
>  1 file changed, 11 insertions(+), 18 deletions(-)
> 
> diff --git a/python_modules/marshal.py b/python_modules/marshal.py
> index b77b910..cbda2ab 100644
> --- a/python_modules/marshal.py
> +++ b/python_modules/marshal.py
> @@ -380,25 +380,18 @@ def write_protocol_marshaller(writer, proto, is_server, private_marshallers):
>              writer.ifdef(channel.attributes["ifdef"][0])
>              writer.header.ifdef(channel.attributes["ifdef"][0])
>          if is_server:
> -            for m in channel.client_messages:
> -                message = m.message_type
> -                f = write_message_marshaller(writer, message, is_server, private_marshallers)
> -                if channel.has_attr("ifdef") and f not in functions:
> -                    functions[f] = channel.attributes["ifdef"][0]
> -                elif message.has_attr("ifdef") and f not in functions:
> -                    functions[f] = message.attributes["ifdef"][0]
> -                else:
> -                    functions[f] = True
> +            messages = channel.client_messages
>          else:
> -            for m in channel.server_messages:
> -                message = m.message_type
> -                f = write_message_marshaller(writer, message, is_server, private_marshallers)
> -                if channel.has_attr("ifdef") and f not in functions:
> -                    functions[f] = channel.attributes["ifdef"][0]
> -                elif message.has_attr("ifdef") and f not in functions:
> -                    functions[f] = message.attributes["ifdef"][0]
> -                else:
> -                    functions[f] = True
> +            messages = channel.server_messages
> +	for m in messages:
> +	    message = m.message_type
> +	    f = write_message_marshaller(writer, message, is_server, private_marshallers)
> +	    if channel.has_attr("ifdef") and f not in functions:
> +		functions[f] = channel.attributes["ifdef"][0]
> +	    elif message.has_attr("ifdef") and f not in functions:
> +		functions[f] = message.attributes["ifdef"][0]
> +	    else:
> +		functions[f] = True

This one replaces spaces with tabs, which in turn upsets python3. ACK
otherwise.

Christophe

Attachment: pgpHejxxfKkGM.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]