summaryrefslogtreecommitdiffstats
path: root/partition.c
diff options
context:
space:
mode:
authorJose M. Guisado Gomez <guigom@riseup.net>2022-04-28 15:46:15 +0200
committerJose M. Guisado Gomez <guigom@riseup.net>2022-04-28 15:47:55 +0200
commitba67cc7a7b5e69b2a39a4aab5805e7915152db16 (patch)
treeb830a15d575f02799290eca01124903e374e9ed7 /partition.c
parentc5ae6a3967da2a2fbf18eff43a86d1157390a8be (diff)
Use c99 struct initialization
Declutters PyTypeObject struct initialization when declaring new types.
Diffstat (limited to 'partition.c')
-rw-r--r--partition.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/partition.c b/partition.c
index a72d3ff..f1cc5e3 100644
--- a/partition.c
+++ b/partition.c
@@ -94,43 +94,18 @@ static PyObject *Partition_repr(PartitionObject *self)
PyTypeObject PartitionType = {
PyVarObject_HEAD_INIT(NULL, 0)
- "libfdisk.Partition", /*tp_name*/
- sizeof(PartitionObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor)Partition_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- NULL, /*tp_getattr*/
- NULL, /*tp_setattr*/
- NULL, /*tp_compare*/
- (reprfunc) Partition_repr,
- NULL, /*tp_as_number*/
- NULL, /*tp_as_sequence*/
- NULL, /*tp_as_mapping*/
- NULL, /*tp_hash */
- NULL, /*tp_call*/
- NULL, /*tp_str*/
- NULL, /*tp_getattro*/
- NULL, /*tp_setattro*/
- NULL, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- Partition_HELP, /* tp_doc */
- NULL, /* tp_traverse */
- NULL, /* tp_clear */
- NULL, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- NULL, /* tp_iter */
- NULL, /* tp_iternext */
- Partition_methods, /* tp_methods */
- Partition_members, /* tp_members */
- Partition_getseters, /* tp_getset */
- NULL, /* tp_base */
- NULL, /* tp_dict */
- NULL, /* tp_descr_get */
- NULL, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)Partition_init, /* tp_init */
- NULL, /* tp_alloc */
- Partition_new, /* tp_new */
+ .tp_name = "libfdisk.Partition",
+ .tp_basicsize = sizeof(PartitionObject),
+ .tp_itemsize = 0,
+ .tp_dealloc = (destructor)Partition_dealloc,
+ .tp_repr = (reprfunc) Partition_repr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR(Partition_HELP),
+ .tp_methods = Partition_methods,
+ .tp_members = Partition_members,
+ .tp_getset = Partition_getseters,
+ .tp_init = (initproc)Partition_init,
+ .tp_new = Partition_new,
};
PyObject *PyObjectResultPartition(struct fdisk_partition *pa)