Skip to content

Commit

Permalink
qapi: Use check_name_str() where it suffices
Browse files Browse the repository at this point in the history
Replace check_name() by check_name_str() where the name is known to be
a string.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-11-armbru@redhat.com>
  • Loading branch information
Markus Armbruster committed Sep 28, 2019
1 parent d7bc17c commit 6ba1ba7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/qapi/common.py
Expand Up @@ -816,8 +816,8 @@ def check_type(value, info, source,

# value is a dictionary, check that each member is okay
for (key, arg) in value.items():
check_name(key, info, "member of %s" % source,
allow_optional=True, permit_upper=permit_upper)
check_name_str(key, info, "member of %s" % source,
allow_optional=True, permit_upper=permit_upper)
if c_name(key, False) == 'u' or c_name(key, False).startswith('has_'):
raise QAPISemError(
info, "member of %s uses reserved name '%s'" % (source, key))
Expand Down Expand Up @@ -920,8 +920,7 @@ def check_union(expr, info):
raise QAPISemError(info, "union '%s' has no branches" % name)

for (key, value) in members.items():
check_name(key, info, "member of union '%s'" % name)

check_name_str(key, info, "member of union '%s'" % name)
check_known_keys(value, info,
"member '%s' of union '%s'" % (key, name),
['type'], ['if'])
Expand Down Expand Up @@ -951,7 +950,7 @@ def check_alternate(expr, info):
raise QAPISemError(info,
"alternate '%s' cannot have empty 'data'" % name)
for (key, value) in members.items():
check_name(key, info, "member of alternate '%s'" % name)
check_name_str(key, info, "member of alternate '%s'" % name)
check_known_keys(value, info,
"member '%s' of alternate '%s'" % (key, name),
['type'], ['if'])
Expand Down

0 comments on commit 6ba1ba7

Please sign in to comment.