提交 412c8507 编写于 作者: R Rich Salz

Remove "lockit" from internal error-hash function

Reviewed-by: NMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1389)
上级 20fc103f
......@@ -17,16 +17,13 @@
#include <openssl/ssl.h>
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_STATS
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP
} OPTION_CHOICE;
OPTIONS errstr_options[] = {
{OPT_HELP_STR, 1, '-', "Usage: %s [options] errnum...\n"},
{OPT_HELP_STR, 1, '-', " errnum Error number\n"},
{"help", OPT_HELP, '-', "Display this summary"},
{"stats", OPT_STATS, '-',
"Print internal hashtable statistics (long!)"},
{NULL}
};
......@@ -48,14 +45,6 @@ int errstr_main(int argc, char **argv)
opt_help(errstr_options);
ret = 0;
goto end;
case OPT_STATS:
lh_ERR_STRING_DATA_node_stats_bio(ERR_get_string_table(),
bio_out);
lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(), bio_out);
lh_ERR_STRING_DATA_node_usage_stats_bio(ERR_get_string_table(),
bio_out);
ret = 0;
goto end;
}
}
......
......@@ -126,7 +126,7 @@ 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, int lockit);
static LHASH_OF(ERR_STRING_DATA) *get_hash(int create);
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
/*
......@@ -155,22 +155,12 @@ 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, int lockit)
static LHASH_OF(ERR_STRING_DATA) *get_hash(int create)
{
LHASH_OF(ERR_STRING_DATA) *ret = NULL;
if (lockit)
CRYPTO_THREAD_write_lock(err_string_lock);
if (!int_error_hash && create) {
if (int_error_hash == NULL && create)
int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
err_string_data_cmp);
}
if (int_error_hash != NULL)
ret = int_error_hash;
if (lockit)
CRYPTO_THREAD_unlock(err_string_lock);
return ret;
return int_error_hash;
}
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
......@@ -179,7 +169,7 @@ static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
LHASH_OF(ERR_STRING_DATA) *hash;
CRYPTO_THREAD_read_lock(err_string_lock);
hash = get_hash(0, 0);
hash = get_hash(0);
if (hash)
p = lh_ERR_STRING_DATA_retrieve(hash, d);
CRYPTO_THREAD_unlock(err_string_lock);
......@@ -303,7 +293,7 @@ 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, 0);
hash = get_hash(1);
if (hash) {
for (; str->error; str++) {
if (lib)
......@@ -330,7 +320,7 @@ int ERR_unload_strings(int lib, ERR_STRING_DATA *str)
return 0;
CRYPTO_THREAD_write_lock(err_string_lock);
hash = get_hash(0, 0);
hash = get_hash(0);
if (hash) {
for (; str->error; str++) {
if (lib)
......@@ -582,11 +572,6 @@ char *ERR_error_string(unsigned long e, char *ret)
return ret;
}
LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void)
{
return get_hash(0, 1);
}
const char *ERR_lib_error_string(unsigned long e)
{
ERR_STRING_DATA d, *p;
......
......@@ -245,8 +245,6 @@ DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid))
ERR_STATE *ERR_get_state(void);
LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
int ERR_get_next_error_library(void);
int ERR_set_mark(void);
......
......@@ -1800,7 +1800,6 @@ EVP_PKEY_meth_get_verify_recover 1785 1_1_0 EXIST::FUNCTION:
NAME_CONSTRAINTS_check 1786 1_1_0 EXIST::FUNCTION:
X509_CERT_AUX_it 1787 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
X509_CERT_AUX_it 1787 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
ERR_get_string_table 1788 1_1_0 EXIST::FUNCTION:
X509_get_X509_PUBKEY 1789 1_1_0 EXIST::FUNCTION:
TXT_DB_create_index 1790 1_1_0 EXIST::FUNCTION:
RAND_set_rand_engine 1791 1_1_0 EXIST::FUNCTION:ENGINE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册