From 1889e57a7140c4f89c8fd9a217f8c3845eb48b5b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 31 Aug 2021 14:37:58 +0200 Subject: qapi: Simplify QAPISchemaIfCond's interface for generating C MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Message-Id: <20210831123809.1107782-2-armbru@redhat.com> Reviewed-by: Marc-André Lureau [Import statements tidied up with isort] --- scripts/qapi/schema.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts/qapi/schema.py') diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 229d24fce9..1451cdec81 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -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) -- cgit v1.2.3