@@ -153,10 +153,13 @@ _x509name_print(_sslmodulestate *state, X509_NAME *name, int indent, unsigned lo
153153 * PySSLCertificate_Type
154154 */
155155
156+ #define _PySSLCertificate_CAST (op ) ((PySSLCertificate *)(op))
157+
156158static PyObject *
157- certificate_repr (PySSLCertificate * self )
159+ certificate_repr (PyObject * op )
158160{
159161 PyObject * osubject , * result ;
162+ PySSLCertificate * self = _PySSLCertificate_CAST (op );
160163
161164 /* subject string is ASCII encoded, UTF-8 chars are quoted */
162165 osubject = _x509name_print (
@@ -176,8 +179,9 @@ certificate_repr(PySSLCertificate *self)
176179}
177180
178181static Py_hash_t
179- certificate_hash (PySSLCertificate * self )
182+ certificate_hash (PyObject * op )
180183{
184+ PySSLCertificate * self = _PySSLCertificate_CAST (op );
181185 if (self -> hash == (Py_hash_t )- 1 ) {
182186 unsigned long hash ;
183187 hash = X509_subject_name_hash (self -> cert );
@@ -191,19 +195,20 @@ certificate_hash(PySSLCertificate *self)
191195}
192196
193197static PyObject *
194- certificate_richcompare (PySSLCertificate * self , PyObject * other , int op )
198+ certificate_richcompare (PyObject * lhs , PyObject * rhs , int op )
195199{
196200 int cmp ;
201+ PySSLCertificate * self = _PySSLCertificate_CAST (lhs );
197202 _sslmodulestate * state = get_state_cert (self );
198203
199- if (Py_TYPE (other ) != state -> PySSLCertificate_Type ) {
204+ if (Py_TYPE (rhs ) != state -> PySSLCertificate_Type ) {
200205 Py_RETURN_NOTIMPLEMENTED ;
201206 }
202207 /* only support == and != */
203208 if ((op != Py_EQ ) && (op != Py_NE )) {
204209 Py_RETURN_NOTIMPLEMENTED ;
205210 }
206- cmp = X509_cmp (self -> cert , ((PySSLCertificate * )other )-> cert );
211+ cmp = X509_cmp (self -> cert , ((PySSLCertificate * )rhs )-> cert );
207212 if (((op == Py_EQ ) && (cmp == 0 )) || ((op == Py_NE ) && (cmp != 0 ))) {
208213 Py_RETURN_TRUE ;
209214 } else {
@@ -212,11 +217,12 @@ certificate_richcompare(PySSLCertificate *self, PyObject *other, int op)
212217}
213218
214219static void
215- certificate_dealloc (PySSLCertificate * self )
220+ certificate_dealloc (PyObject * op )
216221{
222+ PySSLCertificate * self = _PySSLCertificate_CAST (op );
217223 PyTypeObject * tp = Py_TYPE (self );
218224 X509_free (self -> cert );
219- Py_TYPE (self )-> tp_free (self );
225+ ( void ) Py_TYPE (self )-> tp_free (self );
220226 Py_DECREF (tp );
221227}
222228
0 commit comments