mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Removed usage of my_hash_search() with uninitialized HASH.
- Not documented on intened usage - Extra checking takes time for all HASH usage
This commit is contained in:
14
mysys/hash.c
14
mysys/hash.c
@ -246,13 +246,13 @@ uchar* my_hash_first(const HASH *hash, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *current_record)
|
||||
{
|
||||
uchar *res;
|
||||
if (my_hash_inited(hash))
|
||||
res= my_hash_first_from_hash_value(hash,
|
||||
hash->hash_function(hash->charset, key,
|
||||
length ? length : hash->key_length),
|
||||
key, length, current_record);
|
||||
else
|
||||
res= 0;
|
||||
DBUG_ASSERT(my_hash_inited(hash));
|
||||
|
||||
res= my_hash_first_from_hash_value(hash,
|
||||
hash->hash_function(hash->charset, key,
|
||||
length ? length :
|
||||
hash->key_length),
|
||||
key, length, current_record);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -4302,7 +4302,8 @@ longlong Item_func_release_lock::val_int()
|
||||
|
||||
User_level_lock *ull;
|
||||
|
||||
if (!(ull=
|
||||
if (!my_hash_inited(&thd->ull_hash) ||
|
||||
!(ull=
|
||||
(User_level_lock*) my_hash_search(&thd->ull_hash,
|
||||
ull_key.ptr(), ull_key.length())))
|
||||
{
|
||||
|
@ -4365,6 +4365,8 @@ table_hash_search(const char *host, const char *ip, const char *db,
|
||||
static GRANT_COLUMN *
|
||||
column_hash_search(GRANT_TABLE *t, const char *cname, uint length)
|
||||
{
|
||||
if (!my_hash_inited(&t->hash_columns))
|
||||
return (GRANT_COLUMN*) 0;
|
||||
return (GRANT_COLUMN*) my_hash_search(&t->hash_columns,
|
||||
(uchar*) cname, length);
|
||||
}
|
||||
|
@ -458,9 +458,10 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
||||
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if ((handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash,
|
||||
(uchar*) tables->alias,
|
||||
strlen(tables->alias) + 1)))
|
||||
if ((my_hash_inited(&thd->handler_tables_hash)) &&
|
||||
(handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash,
|
||||
(uchar*) tables->alias,
|
||||
strlen(tables->alias) + 1)))
|
||||
{
|
||||
mysql_ha_close_table(handler);
|
||||
my_hash_delete(&thd->handler_tables_hash, (uchar*) handler);
|
||||
@ -497,8 +498,10 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
||||
SQL_HANDLER *mysql_ha_find_handler(THD *thd, const char *name)
|
||||
{
|
||||
SQL_HANDLER *handler;
|
||||
if ((handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash,
|
||||
(uchar*) name, strlen(name) + 1)))
|
||||
if ((my_hash_inited(&thd->handler_tables_hash)) &&
|
||||
(handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash,
|
||||
(uchar*) name,
|
||||
strlen(name) + 1)))
|
||||
{
|
||||
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' table: %p",
|
||||
handler->db.str,
|
||||
|
Reference in New Issue
Block a user