mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Merge branch 'ssl-fixes-after-mbedtls'
* ssl-fixes-after-mbedtls: Fix BEV_IS_SSL() macro Fix preprocessor condition for BEV_IS_SSL() Remove reduntant BEV_IS_MBEDTLS Refs: #1028
This commit is contained in:
commit
587f6c83a3
@ -306,20 +306,20 @@ extern const struct bufferevent_ops bufferevent_ops_pair;
|
||||
#define BEV_IS_FILTER(bevp) ((bevp)->be_ops == &bufferevent_ops_filter)
|
||||
#define BEV_IS_PAIR(bevp) ((bevp)->be_ops == &bufferevent_ops_pair)
|
||||
|
||||
#if defined(EVENT__HAVE_OPENSSL) | defined(EVENT__HAVE_MBEDTLS)
|
||||
extern const struct bufferevent_ops bufferevent_ops_ssl;
|
||||
#define BEV_IS_SSL(bevp) ((bevp)->be_ops == &bufferevent_ops_ssl)
|
||||
#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT__HAVE_MBEDTLS)
|
||||
/* We cannot use the same trick with external declaration,
|
||||
* since there are copy of bufferevent_ops_ssl in each library:
|
||||
* - openssl
|
||||
* - mbedlts
|
||||
*
|
||||
* However we can just compare the name of the bufferevent type for now.
|
||||
* (It is totally fine to use memcmp() here since it will be optimized by the compiler).
|
||||
*/
|
||||
#define BEV_IS_SSL(bevp) (!memcmp((bevp)->be_ops->type, "ssl", 3))
|
||||
#else
|
||||
#define BEV_IS_SSL(bevp) 0
|
||||
#endif
|
||||
|
||||
#if defined(EVENT__HAVE_MBEDTLS)
|
||||
extern const struct bufferevent_ops bufferevent_ops_mbedtls;
|
||||
#define BEV_IS_MBEDTLS(bevp) ((bevp)->be_ops == &bufferevent_ops_mbedtls)
|
||||
#else
|
||||
#define BEV_IS_MBEDTLS(bevp) 0
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
extern const struct bufferevent_ops bufferevent_ops_async;
|
||||
#define BEV_IS_ASYNC(bevp) ((bevp)->be_ops == &bufferevent_ops_async)
|
||||
|
Loading…
x
Reference in New Issue
Block a user