提交 4b8515ba 编写于 作者: R Rich Salz

Rename static global "lock" to "obj_lock"

Breaks djgpp, masks a common kernel function name.
Thanks to Gisle Vanem for pointing this out.
Reviewed-by: NRichard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3776)
上级 edea42c6
...@@ -45,7 +45,7 @@ static int obj_strcmp(const char *a, const char *b) ...@@ -45,7 +45,7 @@ static int obj_strcmp(const char *a, const char *b)
*/ */
static LHASH_OF(OBJ_NAME) *names_lh = NULL; static LHASH_OF(OBJ_NAME) *names_lh = NULL;
static int names_type_num = OBJ_NAME_TYPE_NUM; static int names_type_num = OBJ_NAME_TYPE_NUM;
static CRYPTO_RWLOCK *lock = NULL; static CRYPTO_RWLOCK *obj_lock = NULL;
struct name_funcs_st { struct name_funcs_st {
unsigned long (*hash_func) (const char *name); unsigned long (*hash_func) (const char *name);
...@@ -69,9 +69,9 @@ DEFINE_RUN_ONCE_STATIC(o_names_init) ...@@ -69,9 +69,9 @@ DEFINE_RUN_ONCE_STATIC(o_names_init)
{ {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp); names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
lock = CRYPTO_THREAD_lock_new(); obj_lock = CRYPTO_THREAD_lock_new();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
return names_lh != NULL && lock != NULL; return names_lh != NULL && obj_lock != NULL;
} }
int OBJ_NAME_init(void) int OBJ_NAME_init(void)
...@@ -89,7 +89,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), ...@@ -89,7 +89,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
if (!OBJ_NAME_init()) if (!OBJ_NAME_init())
return 0; return 0;
CRYPTO_THREAD_write_lock(lock); CRYPTO_THREAD_write_lock(obj_lock);
if (name_funcs_stack == NULL) { if (name_funcs_stack == NULL) {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
...@@ -134,7 +134,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), ...@@ -134,7 +134,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
name_funcs->free_func = free_func; name_funcs->free_func = free_func;
out: out:
CRYPTO_THREAD_unlock(lock); CRYPTO_THREAD_unlock(obj_lock);
return ret; return ret;
} }
...@@ -180,7 +180,7 @@ const char *OBJ_NAME_get(const char *name, int type) ...@@ -180,7 +180,7 @@ const char *OBJ_NAME_get(const char *name, int type)
return NULL; return NULL;
if (!OBJ_NAME_init()) if (!OBJ_NAME_init())
return NULL; return NULL;
CRYPTO_THREAD_read_lock(lock); CRYPTO_THREAD_read_lock(obj_lock);
alias = type & OBJ_NAME_ALIAS; alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS; type &= ~OBJ_NAME_ALIAS;
...@@ -202,7 +202,7 @@ const char *OBJ_NAME_get(const char *name, int type) ...@@ -202,7 +202,7 @@ const char *OBJ_NAME_get(const char *name, int type)
} }
} }
CRYPTO_THREAD_unlock(lock); CRYPTO_THREAD_unlock(obj_lock);
return value; return value;
} }
...@@ -212,9 +212,9 @@ int OBJ_NAME_add(const char *name, int type, const char *data) ...@@ -212,9 +212,9 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
int alias, ok = 0; int alias, ok = 0;
if (!OBJ_NAME_init()) if (!OBJ_NAME_init())
return 0; return 0;
CRYPTO_THREAD_write_lock(lock); CRYPTO_THREAD_write_lock(obj_lock);
alias = type & OBJ_NAME_ALIAS; alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS; type &= ~OBJ_NAME_ALIAS;
...@@ -255,7 +255,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) ...@@ -255,7 +255,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
ok = 1; ok = 1;
unlock: unlock:
CRYPTO_THREAD_unlock(lock); CRYPTO_THREAD_unlock(obj_lock);
return ok; return ok;
} }
...@@ -267,7 +267,7 @@ int OBJ_NAME_remove(const char *name, int type) ...@@ -267,7 +267,7 @@ int OBJ_NAME_remove(const char *name, int type)
if (!OBJ_NAME_init()) if (!OBJ_NAME_init())
return 0; return 0;
CRYPTO_THREAD_write_lock(lock); CRYPTO_THREAD_write_lock(obj_lock);
type &= ~OBJ_NAME_ALIAS; type &= ~OBJ_NAME_ALIAS;
on.name = name; on.name = name;
...@@ -289,7 +289,7 @@ int OBJ_NAME_remove(const char *name, int type) ...@@ -289,7 +289,7 @@ int OBJ_NAME_remove(const char *name, int type)
ok = 1; ok = 1;
} }
CRYPTO_THREAD_unlock(lock); CRYPTO_THREAD_unlock(obj_lock);
return ok; return ok;
} }
...@@ -398,10 +398,10 @@ void OBJ_NAME_cleanup(int type) ...@@ -398,10 +398,10 @@ void OBJ_NAME_cleanup(int type)
if (type < 0) { if (type < 0) {
lh_OBJ_NAME_free(names_lh); lh_OBJ_NAME_free(names_lh);
sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free); sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
CRYPTO_THREAD_lock_free(lock); CRYPTO_THREAD_lock_free(obj_lock);
names_lh = NULL; names_lh = NULL;
name_funcs_stack = NULL; name_funcs_stack = NULL;
lock = NULL; obj_lock = NULL;
} else } else
lh_OBJ_NAME_set_down_load(names_lh, down_load); lh_OBJ_NAME_set_down_load(names_lh, down_load);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册