]> git.sesse.net Git - vlc/commitdiff
Fix initialization
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 17 May 2007 17:03:56 +0000 (17:03 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 17 May 2007 17:03:56 +0000 (17:03 +0000)
libs/srtp/Makefile.am
libs/srtp/srtp.c

index 74c4bafe049598c0a67ab9f6dd09f6ff661a426b..7c95859eb507608e7e6377f90e6972c12e43cef4 100644 (file)
@@ -36,3 +36,17 @@ test_aes_SOURCES = test-aes.c
 srtp_SOURCES = recv.c
 srtp_LDADD = libvlc_srtp.la
 
+lcov-run:
+       rm -f *.gcda lcov
+       $(MAKE) $(AM_MAKEFLAGS) check
+
+lcov-pre.out:
+       lcov -c -d . -o lcov.tmp
+
+lcov.out: lcov-pre.out
+       lcov -r lcov.tmp '*test*' > lcov.out
+
+lcov: lcov.out
+       genhtml lcov.out -o lcov
+
+.PHONY: lcov-run
index daf0e18d203db42b3e8f97f033bba23109063fa3..efc434fdd8983c2697fcc5e67d73b4fa447f6630 100644 (file)
@@ -90,13 +90,13 @@ static bool libgcrypt_usable = false;
 
 static void initonce_libgcrypt (void)
 {
-    if ((gcry_check_version ("1.1.94") == NULL)
-     || gcry_control (GCRYCTL_DISABLE_SECMEM, 0)
-     || gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0)
 #ifndef WIN32
-     || gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread)
+    gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
 #endif
-       )
+
+    if ((gcry_check_version ("1.1.94") == NULL)
+     || gcry_control (GCRYCTL_DISABLE_SECMEM, 0)
+     || gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0))
         return;
 
     libgcrypt_usable = true;
@@ -111,13 +111,16 @@ static int init_libgcrypt (void)
 
     pthread_mutex_lock (&mutex);
     pthread_once (&once, initonce_libgcrypt);
-    retval = -libgcrypt_usable;
-    pthread_mutex_unlock (&mutex);
 #else
 # warning FIXME: This is not thread-safe.
     if (!libgcrypt_usable)
         initonce_libgcrypt ();
-    retval = -libgcrypt_usable;
+#endif
+
+    retval = libgcrypt_usable ? 0 : -1;
+
+#ifndef WIN32
+    pthread_mutex_unlock (&mutex);
 #endif
 
     return retval;