mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: Simplify QAPISchemaIfCond's interface for generating C
QAPISchemaIfCond.cgen() is only ever used like gen_if(ifcond.cgen()) and gen_endif(ifcond.cgen()) Simplify to ifcond.gen_if() and ifcond.gen_endif() Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210831123809.1107782-2-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [Import statements tidied up with isort]
This commit is contained in:
parent
3e038d7d7a
commit
1889e57a71
5 changed files with 31 additions and 38 deletions
|
@ -22,12 +22,7 @@ from typing import (
|
|||
Union,
|
||||
)
|
||||
|
||||
from .common import (
|
||||
c_name,
|
||||
gen_endif,
|
||||
gen_if,
|
||||
mcgen,
|
||||
)
|
||||
from .common import c_name, mcgen
|
||||
from .gen import QAPISchemaMonolithicCVisitor
|
||||
from .schema import (
|
||||
QAPISchema,
|
||||
|
@ -124,10 +119,10 @@ def _tree_to_qlit(obj: JSONValue,
|
|||
if obj.comment:
|
||||
ret += indent(level) + f"/* {obj.comment} */\n"
|
||||
if obj.ifcond.is_present():
|
||||
ret += gen_if(obj.ifcond.cgen())
|
||||
ret += obj.ifcond.gen_if()
|
||||
ret += _tree_to_qlit(obj.value, level)
|
||||
if obj.ifcond.is_present():
|
||||
ret += '\n' + gen_endif(obj.ifcond.cgen())
|
||||
ret += '\n' + obj.ifcond.gen_endif()
|
||||
return ret
|
||||
|
||||
ret = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue