summaryrefslogtreecommitdiffstats
path: root/crypto/o_str.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-05-10 16:46:35 +0200
committerTomas Mraz <tomas@openssl.org>2022-05-13 08:30:48 +0200
commit26ccb0e4e0b100423184636457cd6aab4cc779ab (patch)
treeccd8994139c907f5eeb462cdfe84182a85e9a123 /crypto/o_str.c
parent71c17c36d913a82742c7d4ecd91ad047906cdae0 (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/18282)
Diffstat (limited to 'crypto/o_str.c')
-rw-r--r--crypto/o_str.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/crypto/o_str.c b/crypto/o_str.c
index eccaa1e5be..ede2ee4f58 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)