diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-05-10 16:46:35 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-05-13 08:33:50 +0200 |
commit | f3da979ee199bff139a643a16636c8c8e36a3f79 (patch) | |
tree | a9d492a28605641efd0fa6c5a78e33532d9073d7 /crypto/o_str.c | |
parent | 250170d3b03d8e1f56e66c901abb096d8cc80cf4 (diff) |
Avoid code duplication for locale initialization
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18293)
Diffstat (limited to 'crypto/o_str.c')
-rw-r--r-- | crypto/o_str.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/crypto/o_str.c b/crypto/o_str.c index 30e5820c49..9309a7bad4 100644 --- a/crypto/o_str.c +++ b/crypto/o_str.c @@ -18,7 +18,6 @@ #endif #include <openssl/crypto.h> #include "internal/cryptlib.h" -#include "internal/core.h" #define DEFAULT_SEPARATOR ':' #define CH_ZERO '\0' @@ -348,15 +347,13 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen) } #ifndef OPENSSL_NO_LOCALE -# ifndef FIPS_MODULE static locale_t loc; - -void *ossl_c_locale() { +static void *ossl_c_locale(void) { return (void *)loc; } -int ossl_init_casecmp_int() { +int ossl_init_casecmp_int(void) { # ifdef OPENSSL_SYS_WINDOWS loc = _create_locale(LC_COLLATE, "C"); # else @@ -365,10 +362,9 @@ int ossl_init_casecmp_int() { return (loc == (locale_t) 0) ? 0 : 1; } -void ossl_deinit_casecmp() { +void ossl_deinit_casecmp(void) { freelocale(loc); } -# endif int OPENSSL_strcasecmp(const char *s1, const char *s2) { @@ -380,17 +376,11 @@ int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n) return strncasecmp_l(s1, s2, n, (locale_t)ossl_c_locale()); } #else -# ifndef FIPS_MODULE -void *ossl_c_locale() { - return NULL; -} -# endif - -int ossl_init_casecmp_int() { +int ossl_init_casecmp_int(void) { return 1; } -void ossl_deinit_casecmp() { +void ossl_deinit_casecmp(void) { } int OPENSSL_strcasecmp(const char *s1, const char *s2) |