Skip to content

Commit a5308a1

Browse files
author
David Sommerseth
committed
Simplify the ethtool.etherinfo / ethtool_etherinfoType declaration
Use a more modern way to set the needed struct members, avoiding to fill out the blanks manually. Signed-off-by: David Sommerseth <davids@redhat.com>
1 parent 54a6b0b commit a5308a1

File tree

1 file changed

+9
-38
lines changed

1 file changed

+9
-38
lines changed

python-ethtool/etherinfo_obj.c

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -275,43 +275,14 @@ static PyMethodDef _ethtool_etherinfo_methods[] = {
275275
*/
276276
PyTypeObject ethtool_etherinfoType = {
277277
PyObject_HEAD_INIT(NULL)
278-
0, /*ob_size*/
279-
"ethtool.etherinfo", /*tp_name*/
280-
sizeof(etherinfo_py), /*tp_basicsize*/
281-
0, /*tp_itemsize*/
282-
(destructor)_ethtool_etherinfo_dealloc,/*tp_dealloc*/
283-
0, /*tp_print*/
284-
0, /*tp_getattr*/
285-
0, /*tp_setattr*/
286-
0, /*tp_compare*/
287-
0, /*tp_repr*/
288-
0, /*tp_as_number*/
289-
0, /*tp_as_sequence*/
290-
0, /*tp_as_mapping*/
291-
0, /*tp_hash */
292-
0, /*tp_call*/
293-
(reprfunc)_ethtool_etherinfo_str, /*tp_str*/
294-
(getattrofunc)_ethtool_etherinfo_getter, /*tp_getattro*/
295-
(setattrofunc)_ethtool_etherinfo_setter, /*tp_setattro*/
296-
0, /*tp_as_buffer*/
297-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
298-
"Contains information about a specific ethernet device", /* tp_doc */
299-
0, /* tp_traverse */
300-
0, /* tp_clear */
301-
0, /* tp_richcompare */
302-
0, /* tp_weaklistoffset */
303-
0, /* tp_iter */
304-
0, /* tp_iternext */
305-
_ethtool_etherinfo_methods, /* tp_methods */
306-
0, /* tp_members */
307-
0, /* tp_getset */
308-
0, /* tp_base */
309-
0, /* tp_dict */
310-
0, /* tp_descr_get */
311-
0, /* tp_descr_set */
312-
0, /* tp_dictoffset */
313-
0, /* tp_init */
314-
0, /* tp_alloc */
315-
0, /* tp_new */
278+
.tp_name = "ethtool.etherinfo",
279+
.tp_basicsize = sizeof(etherinfo_py),
280+
.tp_flags = Py_TPFLAGS_HAVE_CLASS,
281+
.tp_dealloc = (destructor)_ethtool_etherinfo_dealloc,
282+
.tp_str = (reprfunc)_ethtool_etherinfo_str,
283+
.tp_getattro = (getattrofunc)_ethtool_etherinfo_getter,
284+
.tp_setattro = (setattrofunc)_ethtool_etherinfo_setter,
285+
.tp_methods = _ethtool_etherinfo_methods,
286+
.tp_doc = "Contains information about a specific ethernet device"
316287
};
317288

0 commit comments

Comments
 (0)