diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2022-07-22 21:19:35 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-08-30 21:41:32 +0200 |
commit | 78dad3a0c8135f299d2a6e60b37260f523305f83 (patch) | |
tree | 9b7df2a893ab9b43a348109967608addbfb4625f /python | |
parent | ff55e8f3858ae153ef1996df3d52938f3df6d950 (diff) | |
download | openvswitch-78dad3a0c8135f299d2a6e60b37260f523305f83.tar.gz |
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>
Diffstat (limited to 'python')
-rw-r--r-- | python/ovs/_json.c | 56 |
1 files changed, 11 insertions, 45 deletions
diff --git a/python/ovs/_json.c b/python/ovs/_json.c index c36a140a8..afa97896d 100644 --- a/python/ovs/_json.c +++ b/python/ovs/_json.c @@ -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 |