From 2be8c56a39b0ec2ec5af6ceaf729df154d784a43 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 17 Jun 2019 15:16:36 +0100 Subject: [PATCH] Standardise the function naming conventions in initthread.c Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/9040) --- crypto/include/internal/cryptlib_int.h | 4 ++-- crypto/init.c | 4 ++-- crypto/initthread.c | 30 +++++++++++++------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/crypto/include/internal/cryptlib_int.h b/crypto/include/internal/cryptlib_int.h index 05fad2bf1b..a69bdcd408 100644 --- a/crypto/include/internal/cryptlib_int.h +++ b/crypto/include/internal/cryptlib_int.h @@ -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); /* diff --git a/crypto/init.c b/crypto/init.c index fd24e4f50b..8755e2164f 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -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: diff --git a/crypto/initthread.c b/crypto/initthread.c index 02a51ee5d2..b4ee177c8f 100644 --- a/crypto/initthread.c +++ b/crypto/initthread.c @@ -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; -- 2.25.1