mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
SCRUM
embedded library hash_insert renamed to my_hash_insert to avoid name intersection with another libraries is there better idea? client/mysqltest.c: hash_insert ->my_hash_insert include/hash.h: hash_insert ->my_hash_insert mysys/hash.c: hash_insert ->my_hash_insert mysys/testhash.c: hash_insert ->my_hash_insert sql/ha_berkeley.cc: hash_insert ->my_hash_insert sql/ha_innodb.cc: hash_insert ->my_hash_insert sql/hash_filo.h: hash_insert ->my_hash_insert sql/item_func.cc: hash_insert ->my_hash_insert sql/lock.cc: hash_insert ->my_hash_insert sql/repl_failsafe.cc: hash_insert ->my_hash_insert sql/set_var.cc: hash_insert ->my_hash_insert sql/slave.cc: hash_insert ->my_hash_insert sql/sql_acl.cc: hash_insert ->my_hash_insert sql/sql_base.cc: hash_insert ->my_hash_insert sql/sql_cache.cc: hash_insert ->my_hash_insert sql/sql_parse.cc: hash_insert ->my_hash_insert sql/sql_select.cc: hash_insert ->my_hash_insert sql/sql_udf.cc: hash_insert ->my_hash_insert sql/table.cc: hash_insert ->my_hash_insert tools/mysqlmanager.c: hash_insert ->my_hash_insert
This commit is contained in:
@ -664,7 +664,7 @@ static VAR* var_obtain(char* name, int len)
|
|||||||
if ((v = (VAR*)hash_search(&var_hash, name, len)))
|
if ((v = (VAR*)hash_search(&var_hash, name, len)))
|
||||||
return v;
|
return v;
|
||||||
v = var_init(0, name, len, "", 0);
|
v = var_init(0, name, len, "", 0);
|
||||||
hash_insert(&var_hash, (byte*)v);
|
my_hash_insert(&var_hash, (byte*)v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2400,7 +2400,7 @@ static void var_from_env(const char *name, const char *def_val)
|
|||||||
tmp = def_val;
|
tmp = def_val;
|
||||||
|
|
||||||
v = var_init(0, name, 0, tmp, 0);
|
v = var_init(0, name, 0, tmp, 0);
|
||||||
hash_insert(&var_hash, (byte*)v);
|
my_hash_insert(&var_hash, (byte*)v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2416,9 +2416,9 @@ static void init_var_hash(MYSQL *mysql)
|
|||||||
var_from_env("MYSQL_TEST_DIR", "/tmp");
|
var_from_env("MYSQL_TEST_DIR", "/tmp");
|
||||||
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
|
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
|
||||||
v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0);
|
v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0);
|
||||||
hash_insert(&var_hash, (byte*) v);
|
my_hash_insert(&var_hash, (byte*) v);
|
||||||
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
|
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
|
||||||
hash_insert(&var_hash, (byte*) v);
|
my_hash_insert(&var_hash, (byte*) v);
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ void hash_free(HASH *tree);
|
|||||||
byte *hash_element(HASH *hash,uint idx);
|
byte *hash_element(HASH *hash,uint idx);
|
||||||
gptr hash_search(HASH *info,const byte *key,uint length);
|
gptr hash_search(HASH *info,const byte *key,uint length);
|
||||||
gptr hash_next(HASH *info,const byte *key,uint length);
|
gptr hash_next(HASH *info,const byte *key,uint length);
|
||||||
my_bool hash_insert(HASH *info,const byte *data);
|
my_bool my_hash_insert(HASH *info,const byte *data);
|
||||||
my_bool hash_delete(HASH *hash,byte *record);
|
my_bool hash_delete(HASH *hash,byte *record);
|
||||||
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
|
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
|
||||||
void hash_replace(HASH *hash, uint idx, byte *new_row);
|
void hash_replace(HASH *hash, uint idx, byte *new_row);
|
||||||
|
@ -217,7 +217,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length)
|
|||||||
|
|
||||||
/* Write a hash-key to the hash-index */
|
/* Write a hash-key to the hash-index */
|
||||||
|
|
||||||
my_bool hash_insert(HASH *info,const byte *record)
|
my_bool my_hash_insert(HASH *info,const byte *record)
|
||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
uint halfbuff,hash_nr,first_index,idx;
|
uint halfbuff,hash_nr,first_index,idx;
|
||||||
|
@ -83,7 +83,7 @@ static int do_test()
|
|||||||
n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
|
n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
|
||||||
record= (char*) my_malloc(reclength,MYF(MY_FAE));
|
record= (char*) my_malloc(reclength,MYF(MY_FAE));
|
||||||
sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
|
sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
|
||||||
if (hash_insert(&hash,record))
|
if (my_hash_insert(&hash,record))
|
||||||
{
|
{
|
||||||
printf("Error: %d in write at record: %d\n",my_errno,i);
|
printf("Error: %d in write at record: %d\n",my_errno,i);
|
||||||
goto err;
|
goto err;
|
||||||
@ -199,7 +199,7 @@ static int do_test()
|
|||||||
record=(byte*) my_malloc(reclength,MYF(MY_FAE));
|
record=(byte*) my_malloc(reclength,MYF(MY_FAE));
|
||||||
memcpy(record,recpos,reclength);
|
memcpy(record,recpos,reclength);
|
||||||
record[reclength-1]=rnd(5)+1;
|
record[reclength-1]=rnd(5)+1;
|
||||||
if (hash_insert(&hash2,record))
|
if (my_hash_insert(&hash2,record))
|
||||||
{
|
{
|
||||||
printf("Got error when inserting record: %*s",reclength,record);
|
printf("Got error when inserting record: %*s",reclength,record);
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -2266,7 +2266,7 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
|
|||||||
strmov(share->table_name,table_name);
|
strmov(share->table_name,table_name);
|
||||||
share->key_file = key_file;
|
share->key_file = key_file;
|
||||||
share->key_type = key_type;
|
share->key_type = key_type;
|
||||||
if (hash_insert(&bdb_open_tables, (byte*) share))
|
if (my_hash_insert(&bdb_open_tables, (byte*) share))
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&bdb_mutex); /* purecov: inspected */
|
pthread_mutex_unlock(&bdb_mutex); /* purecov: inspected */
|
||||||
my_free((gptr) share,0); /* purecov: inspected */
|
my_free((gptr) share,0); /* purecov: inspected */
|
||||||
|
@ -4583,7 +4583,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
|
|||||||
share->table_name_length=length;
|
share->table_name_length=length;
|
||||||
share->table_name=(char*) (share+1);
|
share->table_name=(char*) (share+1);
|
||||||
strmov(share->table_name,table_name);
|
strmov(share->table_name,table_name);
|
||||||
if (hash_insert(&innobase_open_tables, (mysql_byte*) share))
|
if (my_hash_insert(&innobase_open_tables, (mysql_byte*) share))
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&innobase_mutex);
|
pthread_mutex_unlock(&innobase_mutex);
|
||||||
my_free((gptr) share,0);
|
my_free((gptr) share,0);
|
||||||
|
@ -116,7 +116,7 @@ public:
|
|||||||
last_link=last_link->prev_used;
|
last_link=last_link->prev_used;
|
||||||
hash_delete(&cache,(byte*) tmp);
|
hash_delete(&cache,(byte*) tmp);
|
||||||
}
|
}
|
||||||
if (hash_insert(&cache,(byte*) entry))
|
if (my_hash_insert(&cache,(byte*) entry))
|
||||||
{
|
{
|
||||||
if (free_element)
|
if (free_element)
|
||||||
(*free_element)(entry); // This should never happen
|
(*free_element)(entry); // This should never happen
|
||||||
|
@ -1742,7 +1742,7 @@ public:
|
|||||||
pthread_cond_init(&cond,NULL);
|
pthread_cond_init(&cond,NULL);
|
||||||
if (key)
|
if (key)
|
||||||
{
|
{
|
||||||
if (hash_insert(&hash_user_locks,(byte*) this))
|
if (my_hash_insert(&hash_user_locks,(byte*) this))
|
||||||
{
|
{
|
||||||
my_free((gptr) key,MYF(0));
|
my_free((gptr) key,MYF(0));
|
||||||
key=0;
|
key=0;
|
||||||
@ -2103,7 +2103,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
|
|||||||
entry->used_query_id=current_thd->query_id;
|
entry->used_query_id=current_thd->query_id;
|
||||||
entry->type=STRING_RESULT;
|
entry->type=STRING_RESULT;
|
||||||
memcpy(entry->name.str, name.str, name.length+1);
|
memcpy(entry->name.str, name.str, name.length+1);
|
||||||
if (hash_insert(hash,(byte*) entry))
|
if (my_hash_insert(hash,(byte*) entry))
|
||||||
{
|
{
|
||||||
my_free((char*) entry,MYF(0));
|
my_free((char*) entry,MYF(0));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -526,7 +526,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
|
|||||||
table->locked_by_name=1;
|
table->locked_by_name=1;
|
||||||
table_list->table=table;
|
table_list->table=table;
|
||||||
|
|
||||||
if (hash_insert(&open_cache, (byte*) table))
|
if (my_hash_insert(&open_cache, (byte*) table))
|
||||||
{
|
{
|
||||||
my_free((gptr) table,MYF(0));
|
my_free((gptr) table,MYF(0));
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
@ -177,7 +177,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
|
|||||||
|
|
||||||
pthread_mutex_lock(&LOCK_slave_list);
|
pthread_mutex_lock(&LOCK_slave_list);
|
||||||
unregister_slave(thd,0,0);
|
unregister_slave(thd,0,0);
|
||||||
res= hash_insert(&slave_list, (byte*) si);
|
res= my_hash_insert(&slave_list, (byte*) si);
|
||||||
pthread_mutex_unlock(&LOCK_slave_list);
|
pthread_mutex_unlock(&LOCK_slave_list);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ HOSTS";
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
si->server_id = server_id;
|
si->server_id = server_id;
|
||||||
hash_insert(&slave_list, (byte*)si);
|
my_hash_insert(&slave_list, (byte*)si);
|
||||||
}
|
}
|
||||||
strmake(si->host, row[1], sizeof(si->host)-1);
|
strmake(si->host, row[1], sizeof(si->host)-1);
|
||||||
si->port = atoi(row[port_ind]);
|
si->port = atoi(row[port_ind]);
|
||||||
|
@ -1925,7 +1925,7 @@ void set_var_init()
|
|||||||
{
|
{
|
||||||
(*var)->name_length= strlen((*var)->name);
|
(*var)->name_length= strlen((*var)->name);
|
||||||
(*var)->option_limits= find_option(my_long_options, (*var)->name);
|
(*var)->option_limits= find_option(my_long_options, (*var)->name);
|
||||||
hash_insert(&system_variable_hash, (byte*) *var);
|
my_hash_insert(&system_variable_hash, (byte*) *var);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Special cases
|
Special cases
|
||||||
|
@ -790,7 +790,7 @@ int add_table_rule(HASH* h, const char* table_spec)
|
|||||||
e->tbl_name = e->db + (dot - table_spec) + 1;
|
e->tbl_name = e->db + (dot - table_spec) + 1;
|
||||||
e->key_len = len;
|
e->key_len = len;
|
||||||
memcpy(e->db, table_spec, len);
|
memcpy(e->db, table_spec, len);
|
||||||
(void)hash_insert(h, (byte*)e);
|
(void)my_hash_insert(h, (byte*)e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,7 +1069,7 @@ static void init_check_host(void)
|
|||||||
else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
|
else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
|
||||||
(uint) strlen(acl_user->host.hostname)))
|
(uint) strlen(acl_user->host.hostname)))
|
||||||
{
|
{
|
||||||
if (hash_insert(&acl_check_hosts,(byte*) acl_user))
|
if (my_hash_insert(&acl_check_hosts,(byte*) acl_user))
|
||||||
{ // End of memory
|
{ // End of memory
|
||||||
allow_all_hosts=1; // Should never happen
|
allow_all_hosts=1; // Should never happen
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -1782,7 +1782,7 @@ public:
|
|||||||
privs = cols = 0; /* purecov: deadcode */
|
privs = cols = 0; /* purecov: deadcode */
|
||||||
return; /* purecov: deadcode */
|
return; /* purecov: deadcode */
|
||||||
}
|
}
|
||||||
hash_insert(&hash_columns, (byte *) mem_check);
|
my_hash_insert(&hash_columns, (byte *) mem_check);
|
||||||
} while (!col_privs->file->index_next(col_privs->record[0]) &&
|
} while (!col_privs->file->index_next(col_privs->record[0]) &&
|
||||||
!key_cmp(col_privs,key,0,key_len));
|
!key_cmp(col_privs,key,0,key_len));
|
||||||
}
|
}
|
||||||
@ -1944,7 +1944,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
|
|||||||
goto end; /* purecov: inspected */
|
goto end; /* purecov: inspected */
|
||||||
}
|
}
|
||||||
GRANT_COLUMN *grant_column = new GRANT_COLUMN(xx->column,privileges);
|
GRANT_COLUMN *grant_column = new GRANT_COLUMN(xx->column,privileges);
|
||||||
hash_insert(&g_t->hash_columns,(byte*) grant_column);
|
my_hash_insert(&g_t->hash_columns,(byte*) grant_column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
table->file->index_end();
|
table->file->index_end();
|
||||||
@ -2295,7 +2295,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||||||
result= -1; /* purecov: deadcode */
|
result= -1; /* purecov: deadcode */
|
||||||
continue; /* purecov: deadcode */
|
continue; /* purecov: deadcode */
|
||||||
}
|
}
|
||||||
hash_insert(&column_priv_hash,(byte*) grant_table);
|
my_hash_insert(&column_priv_hash,(byte*) grant_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If revoke_grant, calculate the new column privilege for tables_priv */
|
/* If revoke_grant, calculate the new column privilege for tables_priv */
|
||||||
@ -2538,7 +2538,7 @@ my_bool grant_init(THD *org_thd)
|
|||||||
{
|
{
|
||||||
GRANT_TABLE *mem_check;
|
GRANT_TABLE *mem_check;
|
||||||
if (!(mem_check=new GRANT_TABLE(t_table,c_table)) ||
|
if (!(mem_check=new GRANT_TABLE(t_table,c_table)) ||
|
||||||
mem_check->ok() && hash_insert(&column_priv_hash,(byte*) mem_check))
|
mem_check->ok() && my_hash_insert(&column_priv_hash,(byte*) mem_check))
|
||||||
{
|
{
|
||||||
/* This could only happen if we are out memory */
|
/* This could only happen if we are out memory */
|
||||||
grant_option= FALSE; /* purecov: deadcode */
|
grant_option= FALSE; /* purecov: deadcode */
|
||||||
|
@ -873,7 +873,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
|
|||||||
table->version=refresh_version;
|
table->version=refresh_version;
|
||||||
table->flush_version=flush_version;
|
table->flush_version=flush_version;
|
||||||
DBUG_PRINT("info", ("inserting table %p into the cache", table));
|
DBUG_PRINT("info", ("inserting table %p into the cache", table));
|
||||||
VOID(hash_insert(&open_cache,(byte*) table));
|
VOID(my_hash_insert(&open_cache,(byte*) table));
|
||||||
}
|
}
|
||||||
|
|
||||||
table->in_use=thd;
|
table->in_use=thd;
|
||||||
|
@ -823,7 +823,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
|||||||
|
|
||||||
Query_cache_query *header = query_block->query();
|
Query_cache_query *header = query_block->query();
|
||||||
header->init_n_lock();
|
header->init_n_lock();
|
||||||
if (hash_insert(&queries, (byte*) query_block))
|
if (my_hash_insert(&queries, (byte*) query_block))
|
||||||
{
|
{
|
||||||
refused++;
|
refused++;
|
||||||
DBUG_PRINT("qcache", ("insertion in query hash"));
|
DBUG_PRINT("qcache", ("insertion in query hash"));
|
||||||
@ -2044,7 +2044,7 @@ Query_cache::insert_table(uint key_len, char *key,
|
|||||||
Query_cache_block_table *list_root = table_block->table(0);
|
Query_cache_block_table *list_root = table_block->table(0);
|
||||||
list_root->n = 0;
|
list_root->n = 0;
|
||||||
list_root->next = list_root->prev = list_root;
|
list_root->next = list_root->prev = list_root;
|
||||||
if (hash_insert(&tables, (const byte *) table_block))
|
if (my_hash_insert(&tables, (const byte *) table_block))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("qcache", ("Can't insert table to hash"));
|
DBUG_PRINT("qcache", ("Can't insert table to hash"));
|
||||||
// write_block_data return locked block
|
// write_block_data return locked block
|
||||||
|
@ -161,7 +161,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
|
|||||||
if (max_user_connections && mqh->connections > max_user_connections)
|
if (max_user_connections && mqh->connections > max_user_connections)
|
||||||
uc->user_resources.connections = max_user_connections;
|
uc->user_resources.connections = max_user_connections;
|
||||||
uc->intime=thd->thr_create_time;
|
uc->intime=thd->thr_create_time;
|
||||||
if (hash_insert(&hash_user_connections, (byte*) uc))
|
if (my_hash_insert(&hash_user_connections, (byte*) uc))
|
||||||
{
|
{
|
||||||
my_free((char*) uc,0);
|
my_free((char*) uc,0);
|
||||||
send_error(thd, 0, NullS); // Out of memory
|
send_error(thd, 0, NullS); // Out of memory
|
||||||
|
@ -7196,7 +7196,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
(void) hash_insert(&hash, key_pos-key_length);
|
(void) my_hash_insert(&hash, key_pos-key_length);
|
||||||
key_pos+=extra_length;
|
key_pos+=extra_length;
|
||||||
}
|
}
|
||||||
my_free((char*) key_buffer,MYF(0));
|
my_free((char*) key_buffer,MYF(0));
|
||||||
|
@ -345,7 +345,7 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
|
|||||||
tmp->returns = ret;
|
tmp->returns = ret;
|
||||||
tmp->type = type;
|
tmp->type = type;
|
||||||
tmp->usage_count=1;
|
tmp->usage_count=1;
|
||||||
if (hash_insert(&udf_hash,(byte*) tmp))
|
if (my_hash_insert(&udf_hash,(byte*) tmp))
|
||||||
return 0;
|
return 0;
|
||||||
using_udf_functions=1;
|
using_udf_functions=1;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -459,7 +459,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
|
|||||||
if (outparam->timestamp_field == reg_field)
|
if (outparam->timestamp_field == reg_field)
|
||||||
outparam->timestamp_field_offset=i;
|
outparam->timestamp_field_offset=i;
|
||||||
if (use_hash)
|
if (use_hash)
|
||||||
(void) hash_insert(&outparam->name_hash,(byte*) *field_ptr); // Will never fail
|
(void) my_hash_insert(&outparam->name_hash,(byte*) *field_ptr); // Will never fail
|
||||||
}
|
}
|
||||||
*field_ptr=0; // End marker
|
*field_ptr=0; // End marker
|
||||||
|
|
||||||
|
@ -818,7 +818,7 @@ HANDLE_DECL(handle_def_exec)
|
|||||||
update_req_len(e);
|
update_req_len(e);
|
||||||
hash_delete(&exec_hash,(byte*)old_e);
|
hash_delete(&exec_hash,(byte*)old_e);
|
||||||
}
|
}
|
||||||
hash_insert(&exec_hash,(byte*)e);
|
my_hash_insert(&exec_hash,(byte*)e);
|
||||||
pthread_mutex_unlock(&lock_exec_hash);
|
pthread_mutex_unlock(&lock_exec_hash);
|
||||||
client_msg(&thd->net,MANAGER_OK,"Exec definition created");
|
client_msg(&thd->net,MANAGER_OK,"Exec definition created");
|
||||||
return 0;
|
return 0;
|
||||||
@ -1666,7 +1666,7 @@ static void init_user_hash()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hash_insert(&user_hash,(gptr)u);
|
my_hash_insert(&user_hash,(gptr)u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my_fclose(f, MYF(0));
|
my_fclose(f, MYF(0));
|
||||||
|
Reference in New Issue
Block a user