@@ -126,6 +126,9 @@ typedef struct {
126126 PyThread_type_lock lock ;
127127} Decompressor ;
128128
129+ #define Compressor_CAST (op ) ((Compressor *)(op))
130+ #define Decompressor_CAST (op ) ((Decompressor *)(op))
131+
129132/* Helper functions. */
130133
131134static int
@@ -857,14 +860,15 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
857860}
858861
859862static void
860- Compressor_dealloc (Compressor * self )
863+ Compressor_dealloc (PyObject * op )
861864{
865+ Compressor * self = Compressor_CAST (op );
862866 lzma_end (& self -> lzs );
863867 if (self -> lock != NULL ) {
864868 PyThread_free_lock (self -> lock );
865869 }
866870 PyTypeObject * tp = Py_TYPE (self );
867- tp -> tp_free (( PyObject * ) self );
871+ tp -> tp_free (self );
868872 Py_DECREF (tp );
869873}
870874
@@ -875,7 +879,7 @@ static PyMethodDef Compressor_methods[] = {
875879};
876880
877881static int
878- Compressor_traverse (Compressor * self , visitproc visit , void * arg )
882+ Compressor_traverse (PyObject * self , visitproc visit , void * arg )
879883{
880884 Py_VISIT (Py_TYPE (self ));
881885 return 0 ;
@@ -1304,8 +1308,9 @@ _lzma_LZMADecompressor_impl(PyTypeObject *type, int format,
13041308}
13051309
13061310static void
1307- Decompressor_dealloc (Decompressor * self )
1311+ Decompressor_dealloc (PyObject * op )
13081312{
1313+ Decompressor * self = Decompressor_CAST (op );
13091314 if (self -> input_buffer != NULL )
13101315 PyMem_Free (self -> input_buffer );
13111316
@@ -1315,12 +1320,12 @@ Decompressor_dealloc(Decompressor *self)
13151320 PyThread_free_lock (self -> lock );
13161321 }
13171322 PyTypeObject * tp = Py_TYPE (self );
1318- tp -> tp_free (( PyObject * ) self );
1323+ tp -> tp_free (self );
13191324 Py_DECREF (tp );
13201325}
13211326
13221327static int
1323- Decompressor_traverse (Decompressor * self , visitproc visit , void * arg )
1328+ Decompressor_traverse (PyObject * self , visitproc visit , void * arg )
13241329{
13251330 Py_VISIT (Py_TYPE (self ));
13261331 return 0 ;
@@ -1633,7 +1638,7 @@ lzma_clear(PyObject *module)
16331638static void
16341639lzma_free (void * module )
16351640{
1636- lzma_clear ((PyObject * )module );
1641+ ( void ) lzma_clear ((PyObject * )module );
16371642}
16381643
16391644static PyModuleDef _lzmamodule = {
0 commit comments