diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-10-14 20:37:38 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-10-14 20:37:38 +0400 |
commit | 9b41c7532d18b04d2f430932ad916886c77fbff6 (patch) | |
tree | f4b1025df0074aacaf5f04f64aac370a80806ee1 /sql/sql_db.cc | |
parent | 2b75d952e68375eb1727040074266bbe1b436653 (diff) | |
download | mariadb-git-9b41c7532d18b04d2f430932ad916886c77fbff6.tar.gz |
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.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 604a2643f43..389c772aa75 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -105,8 +105,8 @@ static my_bool lock_db_insert(const char *dbname, uint length) safe_mutex_assert_owner(&LOCK_lock_db); - if (!(opt= (my_dblock_t*) hash_search(&lock_db_cache, - (uchar*) dbname, length))) + if (!(opt= (my_dblock_t*) my_hash_search(&lock_db_cache, + (uchar*) dbname, length))) { /* Db is not in the hash, insert it */ char *tmp_name; @@ -139,9 +139,9 @@ void lock_db_delete(const char *name, uint length) { my_dblock_t *opt; safe_mutex_assert_owner(&LOCK_lock_db); - if ((opt= (my_dblock_t *)hash_search(&lock_db_cache, - (const uchar*) name, length))) - hash_delete(&lock_db_cache, (uchar*) opt); + if ((opt= (my_dblock_t *)my_hash_search(&lock_db_cache, + (const uchar*) name, length))) + my_hash_delete(&lock_db_cache, (uchar*) opt); } @@ -221,14 +221,14 @@ bool my_database_names_init(void) if (!dboptions_init) { dboptions_init= 1; - error= hash_init(&dboptions, lower_case_table_names ? - &my_charset_bin : system_charset_info, - 32, 0, 0, (hash_get_key) dboptions_get_key, - free_dbopt,0) || - hash_init(&lock_db_cache, lower_case_table_names ? - &my_charset_bin : system_charset_info, - 32, 0, 0, (hash_get_key) lock_db_get_key, - lock_db_free_element,0); + error= my_hash_init(&dboptions, lower_case_table_names ? + &my_charset_bin : system_charset_info, + 32, 0, 0, (my_hash_get_key) dboptions_get_key, + free_dbopt,0) || + my_hash_init(&lock_db_cache, lower_case_table_names ? + &my_charset_bin : system_charset_info, + 32, 0, 0, (my_hash_get_key) lock_db_get_key, + lock_db_free_element,0); } return error; @@ -245,9 +245,9 @@ void my_database_names_free(void) if (dboptions_init) { dboptions_init= 0; - hash_free(&dboptions); + my_hash_free(&dboptions); (void) rwlock_destroy(&LOCK_dboptions); - hash_free(&lock_db_cache); + my_hash_free(&lock_db_cache); } } @@ -259,11 +259,11 @@ void my_database_names_free(void) void my_dbopt_cleanup(void) { rw_wrlock(&LOCK_dboptions); - hash_free(&dboptions); - hash_init(&dboptions, lower_case_table_names ? - &my_charset_bin : system_charset_info, - 32, 0, 0, (hash_get_key) dboptions_get_key, - free_dbopt,0); + my_hash_free(&dboptions); + my_hash_init(&dboptions, lower_case_table_names ? + &my_charset_bin : system_charset_info, + 32, 0, 0, (my_hash_get_key) dboptions_get_key, + free_dbopt,0); rw_unlock(&LOCK_dboptions); } @@ -289,7 +289,7 @@ static my_bool get_dbopt(const char *dbname, HA_CREATE_INFO *create) length= (uint) strlen(dbname); rw_rdlock(&LOCK_dboptions); - if ((opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length))) + if ((opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname, length))) { create->default_table_charset= opt->charset; error= 0; @@ -321,7 +321,8 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) length= (uint) strlen(dbname); rw_wrlock(&LOCK_dboptions); - if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length))) + if (!(opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname, + length))) { /* Options are not in the hash, insert them */ char *tmp_name; @@ -361,9 +362,9 @@ void del_dbopt(const char *path) { my_dbopt_t *opt; rw_wrlock(&LOCK_dboptions); - if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const uchar*) path, - strlen(path)))) - hash_delete(&dboptions, (uchar*) opt); + if ((opt= (my_dbopt_t *)my_hash_search(&dboptions, (const uchar*) path, + strlen(path)))) + my_hash_delete(&dboptions, (uchar*) opt); rw_unlock(&LOCK_dboptions); } @@ -1719,8 +1720,8 @@ lock_databases(THD *thd, const char *db1, uint length1, { pthread_mutex_lock(&LOCK_lock_db); while (!thd->killed && - (hash_search(&lock_db_cache,(uchar*) db1, length1) || - hash_search(&lock_db_cache,(uchar*) db2, length2))) + (my_hash_search(&lock_db_cache,(uchar*) db1, length1) || + my_hash_search(&lock_db_cache,(uchar*) db2, length2))) { wait_for_condition(thd, &LOCK_lock_db, &COND_refresh); pthread_mutex_lock(&LOCK_lock_db); |