@@ -126,6 +126,9 @@ typedef struct {
126
126
PyThread_type_lock lock ;
127
127
} Decompressor ;
128
128
129
+ #define Compressor_CAST (op ) ((Compressor *)(op))
130
+ #define Decompressor_CAST (op ) ((Decompressor *)(op))
131
+
129
132
/* Helper functions. */
130
133
131
134
static int
@@ -857,14 +860,15 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
857
860
}
858
861
859
862
static void
860
- Compressor_dealloc (Compressor * self )
863
+ Compressor_dealloc (PyObject * op )
861
864
{
865
+ Compressor * self = Compressor_CAST (op );
862
866
lzma_end (& self -> lzs );
863
867
if (self -> lock != NULL ) {
864
868
PyThread_free_lock (self -> lock );
865
869
}
866
870
PyTypeObject * tp = Py_TYPE (self );
867
- tp -> tp_free (( PyObject * ) self );
871
+ tp -> tp_free (self );
868
872
Py_DECREF (tp );
869
873
}
870
874
@@ -875,7 +879,7 @@ static PyMethodDef Compressor_methods[] = {
875
879
};
876
880
877
881
static int
878
- Compressor_traverse (Compressor * self , visitproc visit , void * arg )
882
+ Compressor_traverse (PyObject * self , visitproc visit , void * arg )
879
883
{
880
884
Py_VISIT (Py_TYPE (self ));
881
885
return 0 ;
@@ -1304,8 +1308,9 @@ _lzma_LZMADecompressor_impl(PyTypeObject *type, int format,
1304
1308
}
1305
1309
1306
1310
static void
1307
- Decompressor_dealloc (Decompressor * self )
1311
+ Decompressor_dealloc (PyObject * op )
1308
1312
{
1313
+ Decompressor * self = Decompressor_CAST (op );
1309
1314
if (self -> input_buffer != NULL )
1310
1315
PyMem_Free (self -> input_buffer );
1311
1316
@@ -1315,12 +1320,12 @@ Decompressor_dealloc(Decompressor *self)
1315
1320
PyThread_free_lock (self -> lock );
1316
1321
}
1317
1322
PyTypeObject * tp = Py_TYPE (self );
1318
- tp -> tp_free (( PyObject * ) self );
1323
+ tp -> tp_free (self );
1319
1324
Py_DECREF (tp );
1320
1325
}
1321
1326
1322
1327
static int
1323
- Decompressor_traverse (Decompressor * self , visitproc visit , void * arg )
1328
+ Decompressor_traverse (PyObject * self , visitproc visit , void * arg )
1324
1329
{
1325
1330
Py_VISIT (Py_TYPE (self ));
1326
1331
return 0 ;
@@ -1633,7 +1638,7 @@ lzma_clear(PyObject *module)
1633
1638
static void
1634
1639
lzma_free (void * module )
1635
1640
{
1636
- lzma_clear ((PyObject * )module );
1641
+ ( void ) lzma_clear ((PyObject * )module );
1637
1642
}
1638
1643
1639
1644
static PyModuleDef _lzmamodule = {
0 commit comments