mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Backport of:
---------------------------------------------------------- revno: 2617.22.5 committer: Konstantin Osipov <kostja@sun.com> branch nick: mysql-6.0-runtime timestamp: Tue 2009-01-27 05:08:48 +0300 message: Remove non-prefixed use of HASH. Always use my_hash_init(), my_hash_inited(), my_hash_search(), my_hash_element(), my_hash_delete(), my_hash_free() rather than non-prefixed counterparts (hash_init(), etc). Remove the backward-compatible defines.
This commit is contained in:
@@ -465,7 +465,7 @@ THD::THD()
|
||||
killed= NOT_KILLED;
|
||||
col_access=0;
|
||||
is_slave_error= thread_specific_used= FALSE;
|
||||
hash_clear(&handler_tables_hash);
|
||||
my_hash_clear(&handler_tables_hash);
|
||||
tmp_table=0;
|
||||
used_tables=0;
|
||||
cuted_fields= 0L;
|
||||
@@ -525,9 +525,9 @@ THD::THD()
|
||||
profiling.set_thd(this);
|
||||
#endif
|
||||
user_connect=(USER_CONN *)0;
|
||||
hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
|
||||
(hash_get_key) get_var_key,
|
||||
(hash_free_key) free_user_var, 0);
|
||||
my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
|
||||
(my_hash_get_key) get_var_key,
|
||||
(my_hash_free_key) free_user_var, 0);
|
||||
|
||||
sp_proc_cache= NULL;
|
||||
sp_func_cache= NULL;
|
||||
@@ -942,9 +942,9 @@ void THD::change_user(void)
|
||||
cleanup_done= 0;
|
||||
init();
|
||||
stmt_map.reset();
|
||||
hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
|
||||
(hash_get_key) get_var_key,
|
||||
(hash_free_key) free_user_var, 0);
|
||||
my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
|
||||
(my_hash_get_key) get_var_key,
|
||||
(my_hash_free_key) free_user_var, 0);
|
||||
sp_cache_clear(&sp_proc_cache);
|
||||
sp_cache_clear(&sp_func_cache);
|
||||
}
|
||||
@@ -975,7 +975,7 @@ void THD::cleanup(void)
|
||||
}
|
||||
mysql_ha_cleanup(this);
|
||||
delete_dynamic(&user_var_events);
|
||||
hash_free(&user_vars);
|
||||
my_hash_free(&user_vars);
|
||||
close_temporary_tables(this);
|
||||
my_free((char*) variables.time_format, MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free((char*) variables.date_format, MYF(MY_ALLOW_ZERO_PTR));
|
||||
@@ -2602,12 +2602,12 @@ Statement_map::Statement_map() :
|
||||
START_STMT_HASH_SIZE = 16,
|
||||
START_NAME_HASH_SIZE = 16
|
||||
};
|
||||
hash_init(&st_hash, &my_charset_bin, START_STMT_HASH_SIZE, 0, 0,
|
||||
get_statement_id_as_hash_key,
|
||||
delete_statement_as_hash_key, MYF(0));
|
||||
hash_init(&names_hash, system_charset_info, START_NAME_HASH_SIZE, 0, 0,
|
||||
(hash_get_key) get_stmt_name_hash_key,
|
||||
NULL,MYF(0));
|
||||
my_hash_init(&st_hash, &my_charset_bin, START_STMT_HASH_SIZE, 0, 0,
|
||||
get_statement_id_as_hash_key,
|
||||
delete_statement_as_hash_key, MYF(0));
|
||||
my_hash_init(&names_hash, system_charset_info, START_NAME_HASH_SIZE, 0, 0,
|
||||
(my_hash_get_key) get_stmt_name_hash_key,
|
||||
NULL,MYF(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -2672,9 +2672,9 @@ int Statement_map::insert(THD *thd, Statement *statement)
|
||||
|
||||
err_max:
|
||||
if (statement->name.str)
|
||||
hash_delete(&names_hash, (uchar*) statement);
|
||||
my_hash_delete(&names_hash, (uchar*) statement);
|
||||
err_names_hash:
|
||||
hash_delete(&st_hash, (uchar*) statement);
|
||||
my_hash_delete(&st_hash, (uchar*) statement);
|
||||
err_st_hash:
|
||||
return 1;
|
||||
}
|
||||
@@ -2695,9 +2695,9 @@ void Statement_map::erase(Statement *statement)
|
||||
if (statement == last_found_statement)
|
||||
last_found_statement= 0;
|
||||
if (statement->name.str)
|
||||
hash_delete(&names_hash, (uchar *) statement);
|
||||
my_hash_delete(&names_hash, (uchar *) statement);
|
||||
|
||||
hash_delete(&st_hash, (uchar *) statement);
|
||||
my_hash_delete(&st_hash, (uchar *) statement);
|
||||
pthread_mutex_lock(&LOCK_prepared_stmt_count);
|
||||
DBUG_ASSERT(prepared_stmt_count > 0);
|
||||
prepared_stmt_count--;
|
||||
@@ -2727,8 +2727,8 @@ Statement_map::~Statement_map()
|
||||
prepared_stmt_count-= st_hash.records;
|
||||
pthread_mutex_unlock(&LOCK_prepared_stmt_count);
|
||||
|
||||
hash_free(&names_hash);
|
||||
hash_free(&st_hash);
|
||||
my_hash_free(&names_hash);
|
||||
my_hash_free(&st_hash);
|
||||
}
|
||||
|
||||
bool select_dumpvar::send_data(List<Item> &items)
|
||||
@@ -3265,15 +3265,15 @@ void xid_free_hash(void *ptr)
|
||||
bool xid_cache_init()
|
||||
{
|
||||
pthread_mutex_init(&LOCK_xid_cache, MY_MUTEX_INIT_FAST);
|
||||
return hash_init(&xid_cache, &my_charset_bin, 100, 0, 0,
|
||||
xid_get_hash_key, xid_free_hash, 0) != 0;
|
||||
return my_hash_init(&xid_cache, &my_charset_bin, 100, 0, 0,
|
||||
xid_get_hash_key, xid_free_hash, 0) != 0;
|
||||
}
|
||||
|
||||
void xid_cache_free()
|
||||
{
|
||||
if (hash_inited(&xid_cache))
|
||||
if (my_hash_inited(&xid_cache))
|
||||
{
|
||||
hash_free(&xid_cache);
|
||||
my_hash_free(&xid_cache);
|
||||
pthread_mutex_destroy(&LOCK_xid_cache);
|
||||
}
|
||||
}
|
||||
@@ -3281,7 +3281,8 @@ void xid_cache_free()
|
||||
XID_STATE *xid_cache_search(XID *xid)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_xid_cache);
|
||||
XID_STATE *res=(XID_STATE *)hash_search(&xid_cache, xid->key(), xid->key_length());
|
||||
XID_STATE *res=(XID_STATE *)my_hash_search(&xid_cache, xid->key(),
|
||||
xid->key_length());
|
||||
pthread_mutex_unlock(&LOCK_xid_cache);
|
||||
return res;
|
||||
}
|
||||
@@ -3292,7 +3293,7 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
|
||||
XID_STATE *xs;
|
||||
my_bool res;
|
||||
pthread_mutex_lock(&LOCK_xid_cache);
|
||||
if (hash_search(&xid_cache, xid->key(), xid->key_length()))
|
||||
if (my_hash_search(&xid_cache, xid->key(), xid->key_length()))
|
||||
res=0;
|
||||
else if (!(xs=(XID_STATE *)my_malloc(sizeof(*xs), MYF(MY_WME))))
|
||||
res=1;
|
||||
@@ -3311,8 +3312,8 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
|
||||
bool xid_cache_insert(XID_STATE *xid_state)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_xid_cache);
|
||||
DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(),
|
||||
xid_state->xid.key_length())==0);
|
||||
DBUG_ASSERT(my_hash_search(&xid_cache, xid_state->xid.key(),
|
||||
xid_state->xid.key_length())==0);
|
||||
my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state);
|
||||
pthread_mutex_unlock(&LOCK_xid_cache);
|
||||
return res;
|
||||
@@ -3322,7 +3323,7 @@ bool xid_cache_insert(XID_STATE *xid_state)
|
||||
void xid_cache_delete(XID_STATE *xid_state)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_xid_cache);
|
||||
hash_delete(&xid_cache, (uchar *)xid_state);
|
||||
my_hash_delete(&xid_cache, (uchar *)xid_state);
|
||||
pthread_mutex_unlock(&LOCK_xid_cache);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user