History

network: use HAVE_THREADS instead of local hack

HAVE_THREADS is set in config.h if pthreads or w32threads is available, which presumably the proper condition here. Also fixes undefined behaviour in preprocessor directives.

Mans Rullgard committed 14 years ago

Commit 9efbfe51 parent 67a68dc1 file · +6 −8Browse files

Unified · Split

libavformat/network.c+6−8
@@ -22,9 +22,7 @@ · 21 unmodified lines
2222 #include "libavcodec/internal.h"
2323 #include "libavutil/mem.h"
2424
25−#define THREADS (HAVE_PTHREADS || (defined(WIN32) && !defined(__MINGW32CE__)))
26−
27−#if THREADS
25+#if HAVE_THREADS
2826 #if HAVE_PTHREADS
2927 #include <pthread.h>
3028 #else
@@ -35,7 +33,7 @@ · 4 unmodified lines
3533 #if CONFIG_OPENSSL
3634 #include <openssl/ssl.h>
3735 static int openssl_init;
38−#if THREADS
36+#if HAVE_THREADS
3937 #include <openssl/crypto.h>
4038 #include "libavutil/avutil.h"
4139 pthread_mutex_t *openssl_mutexes;
@@ -56,7 +54,7 @@ static unsigned long openssl_thread_id(void) · 14 unmodified lines
5654 #endif
5755 #if CONFIG_GNUTLS
5856 #include <gnutls/gnutls.h>
59−#if THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
57+#if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
6058 #include <gcrypt.h>
6159 #include <errno.h>
6260 #undef malloc
@@ -72,7 +70,7 @@ void ff_tls_init(void) · 9 unmodified lines
7270 if (!openssl_init) {
7371 SSL_library_init();
7472 SSL_load_error_strings();
75−#if THREADS
73+#if HAVE_THREADS
7674 if (!CRYPTO_get_locking_callback()) {
7775 int i;
7876 openssl_mutexes = av_malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks());
@@ -88,7 +86,7 @@ void ff_tls_init(void) · 9 unmodified lines
8886 openssl_init++;
8987 #endif
9088 #if CONFIG_GNUTLS
91−#if THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
89+#if HAVE_THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
9290 if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
9391 gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
9492 #endif
@@ -103,7 +101,7 @@ void ff_tls_deinit(void) · 8 unmodified lines
103101 #if CONFIG_OPENSSL
104102 openssl_init--;
105103 if (!openssl_init) {
106−#if THREADS
104+#if HAVE_THREADS
107105 if (CRYPTO_get_locking_callback() == openssl_lock) {
108106 int i;
109107 CRYPTO_set_locking_callback(NULL);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t