Standardise the function naming conventions in initthread.c
authorMatt Caswell <matt@openssl.org>
Mon, 17 Jun 2019 14:16:36 +0000 (15:16 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 17 Jun 2019 15:19:44 +0000 (16:19 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9040)

crypto/include/internal/cryptlib_int.h
crypto/init.c
crypto/initthread.c

index 05fad2b..a69bdcd 100644 (file)
@@ -14,8 +14,8 @@
 
 int ossl_init_thread_start(void *arg,
                            OSSL_thread_stop_handler_fn handfn);
-int init_thread(void);
-void cleanup_thread(void);
+int ossl_init_thread(void);
+void ossl_cleanup_thread(void);
 void ossl_ctx_thread_stop(void *arg);
 
 /*
index fd24e4f..8755e21 100644 (file)
@@ -56,7 +56,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base)
         goto err;
     OPENSSL_cpuid_setup();
 
-    if (!init_thread())
+    if (!ossl_init_thread())
         return 0;
 
     base_inited = 1;
@@ -428,7 +428,7 @@ void OPENSSL_cleanup(void)
         err_free_strings_int();
     }
 
-    cleanup_thread();
+    ossl_cleanup_thread();
 
     /*
      * Note that cleanup order is important:
index 02a51ee..b4ee177 100644 (file)
@@ -35,10 +35,10 @@ struct thread_event_handler_st {
     THREAD_EVENT_HANDLER *next;
 };
 
-static void ossl_init_thread_stop(void *arg, THREAD_EVENT_HANDLER **hands);
+static void init_thread_stop(void *arg, THREAD_EVENT_HANDLER **hands);
 
 static THREAD_EVENT_HANDLER **
-ossl_init_get_thread_local(CRYPTO_THREAD_LOCAL *local, int alloc, int keep)
+init_get_thread_local(CRYPTO_THREAD_LOCAL *local, int alloc, int keep)
 {
     THREAD_EVENT_HANDLER **hands = CRYPTO_THREAD_get_local(local);
 
@@ -76,22 +76,22 @@ static union {
     CRYPTO_THREAD_LOCAL value;
 } destructor_key = { -1 };
 
-static void ossl_init_thread_destructor(void *hands)
+static void init_thread_destructor(void *hands)
 {
-    ossl_init_thread_stop(NULL, (THREAD_EVENT_HANDLER **)hands);
+    init_thread_stop(NULL, (THREAD_EVENT_HANDLER **)hands);
     OPENSSL_free(hands);
 }
 
-int init_thread(void)
+int ossl_init_thread(void)
 {
     if (!CRYPTO_THREAD_init_local(&destructor_key.value,
-                                  ossl_init_thread_destructor))
+                                  init_thread_destructor))
         return 0;
 
     return 1;
 }
 
-void cleanup_thread(void)
+void ossl_cleanup_thread(void)
 {
     CRYPTO_THREAD_cleanup_local(&destructor_key.value);
     destructor_key.sane = -1;
@@ -112,8 +112,8 @@ void OPENSSL_thread_stop(void)
 {
     if (destructor_key.sane != -1) {
         THREAD_EVENT_HANDLER **hands
-            = ossl_init_get_thread_local(&destructor_key.value, 0, 0);
-        ossl_init_thread_stop(NULL, hands);
+            = init_get_thread_local(&destructor_key.value, 0, 0);
+        init_thread_stop(NULL, hands);
         OPENSSL_free(hands);
     }
 }
@@ -122,8 +122,8 @@ void ossl_ctx_thread_stop(void *arg)
 {
     if (destructor_key.sane != -1) {
         THREAD_EVENT_HANDLER **hands
-            = ossl_init_get_thread_local(&destructor_key.value, 0, 1);
-        ossl_init_thread_stop(arg, hands);
+            = init_get_thread_local(&destructor_key.value, 0, 1);
+        init_thread_stop(arg, hands);
     }
 }
 
@@ -175,14 +175,14 @@ void ossl_ctx_thread_stop(void *arg)
 
     if (local == NULL)
         return;
-    hands = ossl_init_get_thread_local(local, 0, 0);
-    ossl_init_thread_stop(arg, hands);
+    hands = init_get_thread_local(local, 0, 0);
+    init_thread_stop(arg, hands);
     OPENSSL_free(hands);
 }
 #endif /* FIPS_MODE */
 
 
-static void ossl_init_thread_stop(void *arg, THREAD_EVENT_HANDLER **hands)
+static void init_thread_stop(void *arg, THREAD_EVENT_HANDLER **hands)
 {
     THREAD_EVENT_HANDLER *curr, *prev = NULL;
 
@@ -230,7 +230,7 @@ int ossl_init_thread_start(void *arg, OSSL_thread_stop_handler_fn handfn)
     CRYPTO_THREAD_LOCAL *local = &destructor_key.value;
 #endif
 
-    hands = ossl_init_get_thread_local(local, 1, 0);
+    hands = init_get_thread_local(local, 1, 0);
     if (hands == NULL)
         return 0;