mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
python-c-ext: Use designated initializers for type and module.
Python documentation suggests to do so "to avoid listing all the PyTypeObject fields that you don't care about and also to avoid caring about the fields' declaration order". And that does make sense. Acked-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
@@ -170,55 +170,21 @@ static PyMethodDef Parser_methods[] = {
|
||||
|
||||
static PyTypeObject json_ParserType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"ovs._json.Parser", /* tp_name */
|
||||
sizeof (json_ParserObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor) Parser_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||
"Parser objects", /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
Parser_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
Parser_new, /* tp_new */
|
||||
.tp_name = "ovs._json.Parser",
|
||||
.tp_doc = "Parser objects",
|
||||
.tp_basicsize = sizeof(json_ParserObject),
|
||||
.tp_itemsize = 0,
|
||||
.tp_dealloc = (destructor) Parser_dealloc,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_methods = Parser_methods,
|
||||
.tp_new = Parser_new,
|
||||
};
|
||||
|
||||
static struct PyModuleDef moduledef = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"ovs._json", /* m_name */
|
||||
"OVS JSON Parser module", /* m_doc */
|
||||
0, /* m_size */
|
||||
0, /* m_methods */
|
||||
0, /* m_slots */
|
||||
0, /* m_traverse */
|
||||
0, /* m_clear */
|
||||
0, /* m_free */
|
||||
.m_name = "ovs._json",
|
||||
.m_doc = "OVS JSON Parser module",
|
||||
.m_size = 0,
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC
|
||||
|
Reference in New Issue
Block a user