qapi: Use check_name_str() where it suffices

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>
This commit is contained in:
Markus Armbruster 2019-09-27 15:46:23 +02:00
parent d7bc17c602
commit 6ba1ba7f0e

View File

@ -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))
@ -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'])
@ -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'])