]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
rearranged initialization stuff based on Werner's suggestions.
authorNikos Mavrogiannopoulos <nmav@crystal.(none)>
Thu, 4 Dec 2008 19:02:53 +0000 (21:02 +0200)
committerNikos Mavrogiannopoulos <nmav@crystal.(none)>
Thu, 4 Dec 2008 19:02:53 +0000 (21:02 +0200)
lib/gnutls_global.c

index 737a3b2e140bd7b60788def5146081b00325413c..f59a47f83886db4d225ec1ad49b3e2542bdcf25b 100644 (file)
@@ -202,7 +202,16 @@ gnutls_global_init (void)
 
   if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P) == 0)
     {
-      const char *p = gcry_check_version (GCRYPT_VERSION);
+      const char *p;
+
+#ifdef DEBUG
+      /* applications may want to override that, so we only use
+       * it in debugging mode.
+       */
+      gcry_set_log_handler (_gnutls_gcry_log_handler, NULL);
+#endif
+      
+      p = gcry_check_version (GCRYPT_VERSION);
 
       if (p == NULL)
        {
@@ -212,23 +221,14 @@ gnutls_global_init (void)
          return GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY;
        }
 
-      /* gcry_control (GCRYCTL_DISABLE_INTERNAL_LOCKING, NULL, 0); */
+      /* for gcrypt in order to be able to allocate memory */
+      gcry_set_allocation_handler (gnutls_malloc, gnutls_secure_malloc,
+              _gnutls_is_secure_memory, gnutls_realloc, gnutls_free);
 
       gcry_control (GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
 
-#ifdef DEBUG
-      /* applications may want to override that, so we only use
-       * it in debugging mode.
-       */
-      gcry_set_log_handler (_gnutls_gcry_log_handler, NULL);
-#endif
     }
 
-  /* for gcrypt in order to be able to allocate memory */
-  gcry_set_allocation_handler (gnutls_malloc, gnutls_secure_malloc,
-                              _gnutls_is_secure_memory, gnutls_realloc,
-                              gnutls_free);
-
 #ifdef DEBUG
   gnutls_global_set_log_function (dlog);
 #endif