From 955b878810137a34b7eb33cfd22e236663438323 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 22 Jan 2019 17:28:51 -0800 Subject: [PATCH] Reorganize OpenSSL < 1.0.0 compatibility for greater readability. --- evhtp.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/evhtp.c b/evhtp.c index 141a04c..edb1731 100644 --- a/evhtp.c +++ b/evhtp.c @@ -2828,36 +2828,28 @@ htp__accept_cb_(struct evconnlistener * serv, int fd, struct sockaddr * s, int s #ifndef EVHTP_DISABLE_SSL #ifndef EVHTP_DISABLE_EVTHR #if OPENSSL_VERSION_NUMBER < 0x10100000L -static -#if OPENSSL_VERSION_NUMBER >= 0x10000000L -void -#else -unsigned long -#endif -htp__ssl_get_thread_id_( -#if OPENSSL_VERSION_NUMBER >= 0x10000000L - CRYPTO_THREADID * id -#else - void -#endif - ) -{ - unsigned long tid; #ifndef WIN32 - tid = (unsigned long)pthread_self(); +unsigned long tid = (unsigned long)pthread_self(); #else - tid = pthread_self().p; +unsigned long tid = pthread_self().p; #endif -#if OPENSSL_VERSION_NUMBER >= 0x10000000L - CRYPTO_THREADID_set_numeric(id, tid); +#if OPENSSL_VERSION_NUMBER < 0x10000000L +static unsigned long +htp__ssl_get_thread_id_(void) +{ + return tid; +} #else - return tid; +static void +htp__ssl_get_thread_id_(CRYPTO_THREADID *id) +{ + CRYPTO_THREADID_set_numeric(id, tid); +} #endif #endif -} static void htp__ssl_thread_lock_(int mode, int type, const char * file, int line)