@@ -475,7 +475,12 @@ static PyType_Spec sslerror_type_spec = {
475475 *
476476 * We always assume that 'code' is non-negative.
477477 */
478- #define ssl_errcode_to_ht_key (code ) ((const void *)((uintptr_t)(code)))
478+ static inline const void *
479+ ssl_errcode_to_ht_key (ssize_t code )
480+ {
481+ assert (code >= 0 );
482+ return ((const void * )((uintptr_t )(code )));
483+ }
479484
480485/*
481486 * Get the library and reason strings from a packed error code.
@@ -6820,6 +6825,12 @@ sslmodule_init_constants(PyObject *m)
68206825
68216826/* internal hashtable (errcode, libcode) => (reason [PyObject * (unicode)]) */
68226827
6828+ static int
6829+ py_ht_errcode_to_name_comp (const void * k1 , const void * k2 )
6830+ {
6831+ return (uintptr_t )k1 == (uintptr_t )k2 ;
6832+ }
6833+
68236834static void
68246835py_ht_errcode_to_name_free (void * value ) {
68256836 assert (PyUnicode_CheckExact ((PyObject * )value ));
@@ -6830,7 +6841,7 @@ static _Py_hashtable_t *
68306841py_ht_errcode_to_name_create (void ) {
68316842 _Py_hashtable_t * table = _Py_hashtable_new_full (
68326843 _Py_hashtable_hash_ptr ,
6833- _Py_hashtable_compare_direct ,
6844+ py_ht_errcode_to_name_comp ,
68346845 NULL ,
68356846 py_ht_errcode_to_name_free ,
68366847 NULL
@@ -6874,6 +6885,12 @@ py_ht_errcode_to_name_create(void) {
68746885
68756886/* internal hashtable (libcode) => (libname [PyObject * (unicode)]) */
68766887
6888+ static int
6889+ py_ht_libcode_to_name_comp (const void * k1 , const void * k2 )
6890+ {
6891+ return (uintptr_t )k1 == (uintptr_t )k2 ;
6892+ }
6893+
68776894static void
68786895py_ht_libcode_to_name_free (void * value ) {
68796896 assert (PyUnicode_CheckExact ((PyObject * )value ));
@@ -6884,7 +6901,7 @@ static _Py_hashtable_t *
68846901py_ht_libcode_to_name_create (void ) {
68856902 _Py_hashtable_t * table = _Py_hashtable_new_full (
68866903 _Py_hashtable_hash_ptr ,
6887- _Py_hashtable_compare_direct ,
6904+ py_ht_libcode_to_name_comp ,
68886905 NULL ,
68896906 py_ht_libcode_to_name_free ,
68906907 NULL
0 commit comments