1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
embedded library
hash_insert renamed to my_hash_insert to avoid name intersection
with another libraries
is there better idea?
This commit is contained in:
hf@deer.(none)
2003-09-19 14:44:31 +05:00
parent 0868446b3e
commit a2dbfaefa3
20 changed files with 32 additions and 32 deletions

View File

@ -664,7 +664,7 @@ static VAR* var_obtain(char* name, int len)
if ((v = (VAR*)hash_search(&var_hash, name, len)))
return v;
v = var_init(0, name, len, "", 0);
hash_insert(&var_hash, (byte*)v);
my_hash_insert(&var_hash, (byte*)v);
return v;
}
@ -2400,7 +2400,7 @@ static void var_from_env(const char *name, const char *def_val)
tmp = def_val;
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("BIG_TEST", opt_big_test ? "1" : "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);
hash_insert(&var_hash, (byte*) v);
my_hash_insert(&var_hash, (byte*) v);
DBUG_VOID_RETURN;
}

View File

@ -49,7 +49,7 @@ void hash_free(HASH *tree);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(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_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, uint idx, byte *new_row);

View File

@ -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 */
my_bool hash_insert(HASH *info,const byte *record)
my_bool my_hash_insert(HASH *info,const byte *record)
{
int flag;
uint halfbuff,hash_nr,first_index,idx;

View File

@ -83,7 +83,7 @@ static int do_test()
n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
record= (char*) my_malloc(reclength,MYF(MY_FAE));
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);
goto err;
@ -199,7 +199,7 @@ static int do_test()
record=(byte*) my_malloc(reclength,MYF(MY_FAE));
memcpy(record,recpos,reclength);
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);
goto err;

View File

@ -2266,7 +2266,7 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
strmov(share->table_name,table_name);
share->key_file = key_file;
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 */
my_free((gptr) share,0); /* purecov: inspected */

View File

@ -4583,7 +4583,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
share->table_name_length=length;
share->table_name=(char*) (share+1);
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);
my_free((gptr) share,0);

View File

@ -116,7 +116,7 @@ public:
last_link=last_link->prev_used;
hash_delete(&cache,(byte*) tmp);
}
if (hash_insert(&cache,(byte*) entry))
if (my_hash_insert(&cache,(byte*) entry))
{
if (free_element)
(*free_element)(entry); // This should never happen

View File

@ -1742,7 +1742,7 @@ public:
pthread_cond_init(&cond,NULL);
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));
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->type=STRING_RESULT;
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));
return 0;

View File

@ -526,7 +526,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
table->locked_by_name=1;
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));
DBUG_RETURN(-1);

View File

@ -177,7 +177,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
pthread_mutex_lock(&LOCK_slave_list);
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);
return res;
@ -540,7 +540,7 @@ HOSTS";
goto err;
}
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);
si->port = atoi(row[port_ind]);

View File

@ -1925,7 +1925,7 @@ void set_var_init()
{
(*var)->name_length= strlen((*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

View File

@ -790,7 +790,7 @@ int add_table_rule(HASH* h, const char* table_spec)
e->tbl_name = e->db + (dot - table_spec) + 1;
e->key_len = len;
memcpy(e->db, table_spec, len);
(void)hash_insert(h, (byte*)e);
(void)my_hash_insert(h, (byte*)e);
return 0;
}

View File

@ -1069,7 +1069,7 @@ static void init_check_host(void)
else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
(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
allow_all_hosts=1; // Should never happen
DBUG_VOID_RETURN;
@ -1782,7 +1782,7 @@ public:
privs = cols = 0; /* 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]) &&
!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 */
}
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();
@ -2295,7 +2295,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
result= -1; /* 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 */
@ -2538,7 +2538,7 @@ my_bool grant_init(THD *org_thd)
{
GRANT_TABLE *mem_check;
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 */
grant_option= FALSE; /* purecov: deadcode */

View File

@ -873,7 +873,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
table->version=refresh_version;
table->flush_version=flush_version;
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;

View File

@ -823,7 +823,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
Query_cache_query *header = query_block->query();
header->init_n_lock();
if (hash_insert(&queries, (byte*) query_block))
if (my_hash_insert(&queries, (byte*) query_block))
{
refused++;
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);
list_root->n = 0;
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"));
// write_block_data return locked block

View File

@ -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)
uc->user_resources.connections = max_user_connections;
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);
send_error(thd, 0, NullS); // Out of memory

View File

@ -7196,7 +7196,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
goto err;
}
else
(void) hash_insert(&hash, key_pos-key_length);
(void) my_hash_insert(&hash, key_pos-key_length);
key_pos+=extra_length;
}
my_free((char*) key_buffer,MYF(0));

View File

@ -345,7 +345,7 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
tmp->returns = ret;
tmp->type = type;
tmp->usage_count=1;
if (hash_insert(&udf_hash,(byte*) tmp))
if (my_hash_insert(&udf_hash,(byte*) tmp))
return 0;
using_udf_functions=1;
return tmp;

View File

@ -459,7 +459,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (outparam->timestamp_field == reg_field)
outparam->timestamp_field_offset=i;
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

View File

@ -818,7 +818,7 @@ HANDLE_DECL(handle_def_exec)
update_req_len(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);
client_msg(&thd->net,MANAGER_OK,"Exec definition created");
return 0;
@ -1666,7 +1666,7 @@ static void init_user_hash()
}
else
{
hash_insert(&user_hash,(gptr)u);
my_hash_insert(&user_hash,(gptr)u);
}
}
my_fclose(f, MYF(0));