mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00: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:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user