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
|
@ -24,6 +24,8 @@ from .common import (
|
|||
c_name,
|
||||
cgen_ifcond,
|
||||
docgen_ifcond,
|
||||
gen_endif,
|
||||
gen_if,
|
||||
)
|
||||
from .error import QAPIError, QAPISemError, QAPISourceError
|
||||
from .expr import check_exprs
|
||||
|
@ -34,9 +36,15 @@ class QAPISchemaIfCond:
|
|||
def __init__(self, ifcond=None):
|
||||
self.ifcond = ifcond or {}
|
||||
|
||||
def cgen(self):
|
||||
def _cgen(self):
|
||||
return cgen_ifcond(self.ifcond)
|
||||
|
||||
def gen_if(self):
|
||||
return gen_if(self._cgen())
|
||||
|
||||
def gen_endif(self):
|
||||
return gen_endif(self._cgen())
|
||||
|
||||
def docgen(self):
|
||||
return docgen_ifcond(self.ifcond)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue