mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-08-07 01:52:07 +00:00
codegen: Simplify if/else blocks
Blocks were mainly the same, this reduces the amount of code. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
86b0568055
commit
aa43c0d61e
@ -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
|
||||
if channel.has_attr("ifdef"):
|
||||
writer.endif(channel.attributes["ifdef"][0])
|
||||
writer.header.endif(channel.attributes["ifdef"][0])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user