qapi: Drop unused c_null()
Now that we are always bulk-initializing a QAPI C struct to 0 (whether by g_malloc0() or by 'Type arg = {0};'), we no longer have any clients of c_null() in the generator for per-element initialization. This patch is easy enough to revert if we find a use in the future, but in the present, get rid of the dead code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1458254921-17042-12-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
12f254fd5f
commit
861877a0dd
|
@ -836,9 +836,6 @@ class QAPISchemaType(QAPISchemaEntity):
|
||||||
def c_unboxed_type(self):
|
def c_unboxed_type(self):
|
||||||
return self.c_type()
|
return self.c_type()
|
||||||
|
|
||||||
def c_null(self):
|
|
||||||
return 'NULL'
|
|
||||||
|
|
||||||
def json_type(self):
|
def json_type(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -854,14 +851,13 @@ class QAPISchemaType(QAPISchemaEntity):
|
||||||
|
|
||||||
|
|
||||||
class QAPISchemaBuiltinType(QAPISchemaType):
|
class QAPISchemaBuiltinType(QAPISchemaType):
|
||||||
def __init__(self, name, json_type, c_type, c_null):
|
def __init__(self, name, json_type, c_type):
|
||||||
QAPISchemaType.__init__(self, name, None)
|
QAPISchemaType.__init__(self, name, None)
|
||||||
assert not c_type or isinstance(c_type, str)
|
assert not c_type or isinstance(c_type, str)
|
||||||
assert json_type in ('string', 'number', 'int', 'boolean', 'null',
|
assert json_type in ('string', 'number', 'int', 'boolean', 'null',
|
||||||
'value')
|
'value')
|
||||||
self._json_type_name = json_type
|
self._json_type_name = json_type
|
||||||
self._c_type_name = c_type
|
self._c_type_name = c_type
|
||||||
self._c_null_val = c_null
|
|
||||||
|
|
||||||
def c_name(self):
|
def c_name(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -874,9 +870,6 @@ class QAPISchemaBuiltinType(QAPISchemaType):
|
||||||
return 'const ' + self._c_type_name
|
return 'const ' + self._c_type_name
|
||||||
return self._c_type_name
|
return self._c_type_name
|
||||||
|
|
||||||
def c_null(self):
|
|
||||||
return self._c_null_val
|
|
||||||
|
|
||||||
def json_type(self):
|
def json_type(self):
|
||||||
return self._json_type_name
|
return self._json_type_name
|
||||||
|
|
||||||
|
@ -909,10 +902,6 @@ class QAPISchemaEnumType(QAPISchemaType):
|
||||||
def member_names(self):
|
def member_names(self):
|
||||||
return [v.name for v in self.values]
|
return [v.name for v in self.values]
|
||||||
|
|
||||||
def c_null(self):
|
|
||||||
return c_enum_const(self.name, (self.member_names() + ['_MAX'])[0],
|
|
||||||
self.prefix)
|
|
||||||
|
|
||||||
def json_type(self):
|
def json_type(self):
|
||||||
return 'string'
|
return 'string'
|
||||||
|
|
||||||
|
@ -1240,9 +1229,8 @@ class QAPISchema(object):
|
||||||
def lookup_type(self, name):
|
def lookup_type(self, name):
|
||||||
return self.lookup_entity(name, QAPISchemaType)
|
return self.lookup_entity(name, QAPISchemaType)
|
||||||
|
|
||||||
def _def_builtin_type(self, name, json_type, c_type, c_null):
|
def _def_builtin_type(self, name, json_type, c_type):
|
||||||
self._def_entity(QAPISchemaBuiltinType(name, json_type,
|
self._def_entity(QAPISchemaBuiltinType(name, json_type, c_type))
|
||||||
c_type, c_null))
|
|
||||||
# TODO As long as we have QAPI_TYPES_BUILTIN to share multiple
|
# TODO As long as we have QAPI_TYPES_BUILTIN to share multiple
|
||||||
# qapi-types.h from a single .c, all arrays of builtins must be
|
# qapi-types.h from a single .c, all arrays of builtins must be
|
||||||
# declared in the first file whether or not they are used. Nicer
|
# declared in the first file whether or not they are used. Nicer
|
||||||
|
@ -1251,20 +1239,20 @@ class QAPISchema(object):
|
||||||
self._make_array_type(name, None)
|
self._make_array_type(name, None)
|
||||||
|
|
||||||
def _def_predefineds(self):
|
def _def_predefineds(self):
|
||||||
for t in [('str', 'string', 'char' + pointer_suffix, 'NULL'),
|
for t in [('str', 'string', 'char' + pointer_suffix),
|
||||||
('number', 'number', 'double', '0'),
|
('number', 'number', 'double'),
|
||||||
('int', 'int', 'int64_t', '0'),
|
('int', 'int', 'int64_t'),
|
||||||
('int8', 'int', 'int8_t', '0'),
|
('int8', 'int', 'int8_t'),
|
||||||
('int16', 'int', 'int16_t', '0'),
|
('int16', 'int', 'int16_t'),
|
||||||
('int32', 'int', 'int32_t', '0'),
|
('int32', 'int', 'int32_t'),
|
||||||
('int64', 'int', 'int64_t', '0'),
|
('int64', 'int', 'int64_t'),
|
||||||
('uint8', 'int', 'uint8_t', '0'),
|
('uint8', 'int', 'uint8_t'),
|
||||||
('uint16', 'int', 'uint16_t', '0'),
|
('uint16', 'int', 'uint16_t'),
|
||||||
('uint32', 'int', 'uint32_t', '0'),
|
('uint32', 'int', 'uint32_t'),
|
||||||
('uint64', 'int', 'uint64_t', '0'),
|
('uint64', 'int', 'uint64_t'),
|
||||||
('size', 'int', 'uint64_t', '0'),
|
('size', 'int', 'uint64_t'),
|
||||||
('bool', 'boolean', 'bool', 'false'),
|
('bool', 'boolean', 'bool'),
|
||||||
('any', 'value', 'QObject' + pointer_suffix, 'NULL')]:
|
('any', 'value', 'QObject' + pointer_suffix)]:
|
||||||
self._def_builtin_type(*t)
|
self._def_builtin_type(*t)
|
||||||
self.the_empty_object_type = QAPISchemaObjectType('q_empty', None,
|
self.the_empty_object_type = QAPISchemaObjectType('q_empty', None,
|
||||||
None, [], None)
|
None, [], None)
|
||||||
|
|
Loading…
Reference in a new issue