aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-10-24 13:02:33 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-10-29 07:35:16 +0100
commit2ce51ef68f243fb705c103498d8888d71532ccd3 (patch)
tree894670e2cdbb755a8585a5694e82f34a715b57aa /scripts/qapi
parentc145bfda18f63c67f77ecbedbbd5a68fed2c4a4a (diff)
qapi: Fold normalize_features() into check_features()
check_features() is always called together with normalize_features(): the former in check_struct() and check_command(), the latter in their caller check_exprs(). Fold the latter into the former. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-16-armbru@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/expr.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index aa0fe69f99..66014e2bb2 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -173,17 +173,13 @@ def check_type(value, info, source,
check_type(arg['type'], info, key_source, allow_array=True)
-def normalize_features(features):
- if isinstance(features, list):
- features[:] = [f if isinstance(f, dict) else {'name': f}
- for f in features]
-
-
def check_features(features, info):
if features is None:
return
if not isinstance(features, list):
raise QAPISemError(info, "'features' must be an array")
+ features[:] = [f if isinstance(f, dict) else {'name': f}
+ for f in features]
for f in features:
source = "'features' member"
assert isinstance(f, dict)
@@ -347,7 +343,6 @@ def check_exprs(exprs):
check_keys(expr, info, meta,
['struct', 'data'], ['base', 'if', 'features'])
normalize_members(expr['data'])
- normalize_features(expr.get('features'))
check_struct(expr, info)
elif meta == 'command':
check_keys(expr, info, meta,
@@ -356,7 +351,6 @@ def check_exprs(exprs):
'gen', 'success-response', 'allow-oob',
'allow-preconfig'])
normalize_members(expr.get('data'))
- normalize_features(expr.get('features'))
check_command(expr, info)
elif meta == 'event':
check_keys(expr, info, meta,