Fix open ssl forwarding macros.

This patch fixes them in many ways:
- use Q_UNLIKELY to mark an error case
- reduce QtNetwork library size by 40315 bytes
- fix DEFINEFUNC9 which had wrong logic, happily it was not used
anywhere

Change-Id: Ic46a569f85aa22a00ecd88158e60c52f4665ec4c
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Jędrzej Nowacki 2013-09-25 16:05:09 +00:00 committed by The Qt Project
parent ec716cc5bf
commit 4aca7847be
2 changed files with 24 additions and 16 deletions

View File

@ -114,6 +114,13 @@ QT_BEGIN_NAMESPACE
possibly with a different version of OpenSSL. possibly with a different version of OpenSSL.
*/ */
namespace {
void qsslSocketUnresolvedSymbolWarning(const char *functionName)
{
qWarning("QSslSocket: cannot call unresolved function %s", functionName);
}
}
#ifdef SSLEAY_MACROS #ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return) DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif #endif

View File

@ -69,6 +69,7 @@
// //
#include "qsslsocket_openssl_p.h" #include "qsslsocket_openssl_p.h"
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -82,8 +83,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg); \ typedef ret (*_q_PTR_##func)(arg); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg) { \ ret q_##func(arg) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a); \ funcret _q_##func(a); \
@ -94,8 +95,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2); \ typedef ret (*_q_PTR_##func)(arg1, arg2); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2) { \ ret q_##func(arg1, arg2) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func);\ qsslSocketUnresolvedSymbolWarning(#func);\
err; \ err; \
} \ } \
funcret _q_##func(a, b); \ funcret _q_##func(a, b); \
@ -106,8 +107,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3); \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3) { \ ret q_##func(arg1, arg2, arg3) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a, b, c); \ funcret _q_##func(a, b, c); \
@ -118,8 +119,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4); \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4) { \ ret q_##func(arg1, arg2, arg3, arg4) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a, b, c, d); \ funcret _q_##func(a, b, c, d); \
@ -130,8 +131,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5); \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5) { \ ret q_##func(arg1, arg2, arg3, arg4, arg5) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a, b, c, d, e); \ funcret _q_##func(a, b, c, d, e); \
@ -142,8 +143,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6); \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { \ ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a, b, c, d, e, f); \ funcret _q_##func(a, b, c, d, e, f); \
@ -154,8 +155,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \ ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \
if (!_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a, b, c, d, e, f, g); \ funcret _q_##func(a, b, c, d, e, f, g); \
@ -166,8 +167,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
static _q_PTR_##func _q_##func = 0; \ static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \ ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \
if (_q_##func) { \ if (Q_UNLIKELY(!_q_##func)) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \ qsslSocketUnresolvedSymbolWarning(#func); \
err; \ err; \
} \ } \
funcret _q_##func(a, b, c, d, e, f, g, h, i); \ funcret _q_##func(a, b, c, d, e, f, g, h, i); \