aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/err
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-08-03 15:24:57 -0400
committerRich Salz <rsalz@openssl.org>2016-08-04 14:23:08 -0400
commit219116d8667cd208a92323a9b95a20e3c7e3f9eb (patch)
tree641b0deb8c1f1f869bf61550b06f3e7102e37b03 /crypto/err
parent412c8507ee61aeb1fcac4b6e84cd7e6501789124 (diff)
downloadopenssl-219116d8667cd208a92323a9b95a20e3c7e3f9eb.tar.gz
Remove get_hash completely
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1389)
Diffstat (limited to 'crypto/err')
-rw-r--r--crypto/err/err.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/crypto/err/err.c b/crypto/err/err.c
index eac2025fd5..584bb9e10d 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -125,8 +125,6 @@ static CRYPTO_THREAD_LOCAL err_thread_local;
static CRYPTO_ONCE err_string_init = CRYPTO_ONCE_STATIC_INIT;
static CRYPTO_RWLOCK *err_string_lock;
-/* Predeclarations of the "err_defaults" functions */
-static LHASH_OF(ERR_STRING_DATA) *get_hash(int create);
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
/*
@@ -155,23 +153,13 @@ static int err_string_data_cmp(const ERR_STRING_DATA *a,
return (int)(a->error - b->error);
}
-static LHASH_OF(ERR_STRING_DATA) *get_hash(int create)
-{
- if (int_error_hash == NULL && create)
- int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
- err_string_data_cmp);
- return int_error_hash;
-}
-
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
{
ERR_STRING_DATA *p = NULL;
- LHASH_OF(ERR_STRING_DATA) *hash;
CRYPTO_THREAD_read_lock(err_string_lock);
- hash = get_hash(0);
- if (hash)
- p = lh_ERR_STRING_DATA_retrieve(hash, d);
+ if (int_error_hash != NULL)
+ p = lh_ERR_STRING_DATA_retrieve(int_error_hash, d);
CRYPTO_THREAD_unlock(err_string_lock);
return p;
@@ -290,15 +278,15 @@ int ERR_load_ERR_strings(void)
static void err_load_strings(int lib, ERR_STRING_DATA *str)
{
- LHASH_OF(ERR_STRING_DATA) *hash;
-
CRYPTO_THREAD_write_lock(err_string_lock);
- hash = get_hash(1);
- if (hash) {
+ if (int_error_hash == NULL)
+ int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
+ err_string_data_cmp);
+ if (int_error_hash != NULL) {
for (; str->error; str++) {
if (lib)
str->error |= ERR_PACK(lib, 0, 0);
- (void)lh_ERR_STRING_DATA_insert(hash, str);
+ (void)lh_ERR_STRING_DATA_insert(int_error_hash, str);
}
}
CRYPTO_THREAD_unlock(err_string_lock);
@@ -314,18 +302,15 @@ int ERR_load_strings(int lib, ERR_STRING_DATA *str)
int ERR_unload_strings(int lib, ERR_STRING_DATA *str)
{
- LHASH_OF(ERR_STRING_DATA) *hash;
-
if (!RUN_ONCE(&err_string_init, do_err_strings_init))
return 0;
CRYPTO_THREAD_write_lock(err_string_lock);
- hash = get_hash(0);
- if (hash) {
+ if (int_error_hash != NULL) {
for (; str->error; str++) {
if (lib)
str->error |= ERR_PACK(lib, 0, 0);
- (void)lh_ERR_STRING_DATA_delete(hash, str);
+ (void)lh_ERR_STRING_DATA_delete(int_error_hash, str);
}
}
CRYPTO_THREAD_unlock(err_string_lock);