Skip to content

Commit a2dbfae

Browse files
author
hf@deer.(none)
committed
SCRUM
embedded library hash_insert renamed to my_hash_insert to avoid name intersection with another libraries is there better idea?
1 parent 0868446 commit a2dbfae

20 files changed

+32
-32
lines changed

client/mysqltest.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static VAR* var_obtain(char* name, int len)
664664
if ((v = (VAR*)hash_search(&var_hash, name, len)))
665665
return v;
666666
v = var_init(0, name, len, "", 0);
667-
hash_insert(&var_hash, (byte*)v);
667+
my_hash_insert(&var_hash, (byte*)v);
668668
return v;
669669
}
670670

@@ -2400,7 +2400,7 @@ static void var_from_env(const char *name, const char *def_val)
24002400
tmp = def_val;
24012401

24022402
v = var_init(0, name, 0, tmp, 0);
2403-
hash_insert(&var_hash, (byte*)v);
2403+
my_hash_insert(&var_hash, (byte*)v);
24042404
}
24052405

24062406

@@ -2416,9 +2416,9 @@ static void init_var_hash(MYSQL *mysql)
24162416
var_from_env("MYSQL_TEST_DIR", "/tmp");
24172417
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
24182418
v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0);
2419-
hash_insert(&var_hash, (byte*) v);
2419+
my_hash_insert(&var_hash, (byte*) v);
24202420
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
2421-
hash_insert(&var_hash, (byte*) v);
2421+
my_hash_insert(&var_hash, (byte*) v);
24222422

24232423
DBUG_VOID_RETURN;
24242424
}

include/hash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void hash_free(HASH *tree);
4949
byte *hash_element(HASH *hash,uint idx);
5050
gptr hash_search(HASH *info,const byte *key,uint length);
5151
gptr hash_next(HASH *info,const byte *key,uint length);
52-
my_bool hash_insert(HASH *info,const byte *data);
52+
my_bool my_hash_insert(HASH *info,const byte *data);
5353
my_bool hash_delete(HASH *hash,byte *record);
5454
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
5555
void hash_replace(HASH *hash, uint idx, byte *new_row);

mysys/hash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length)
217217

218218
/* Write a hash-key to the hash-index */
219219

220-
my_bool hash_insert(HASH *info,const byte *record)
220+
my_bool my_hash_insert(HASH *info,const byte *record)
221221
{
222222
int flag;
223223
uint halfbuff,hash_nr,first_index,idx;

mysys/testhash.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int do_test()
8383
n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
8484
record= (char*) my_malloc(reclength,MYF(MY_FAE));
8585
sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
86-
if (hash_insert(&hash,record))
86+
if (my_hash_insert(&hash,record))
8787
{
8888
printf("Error: %d in write at record: %d\n",my_errno,i);
8989
goto err;
@@ -199,7 +199,7 @@ static int do_test()
199199
record=(byte*) my_malloc(reclength,MYF(MY_FAE));
200200
memcpy(record,recpos,reclength);
201201
record[reclength-1]=rnd(5)+1;
202-
if (hash_insert(&hash2,record))
202+
if (my_hash_insert(&hash2,record))
203203
{
204204
printf("Got error when inserting record: %*s",reclength,record);
205205
goto err;

sql/ha_berkeley.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
22662266
strmov(share->table_name,table_name);
22672267
share->key_file = key_file;
22682268
share->key_type = key_type;
2269-
if (hash_insert(&bdb_open_tables, (byte*) share))
2269+
if (my_hash_insert(&bdb_open_tables, (byte*) share))
22702270
{
22712271
pthread_mutex_unlock(&bdb_mutex); /* purecov: inspected */
22722272
my_free((gptr) share,0); /* purecov: inspected */

sql/ha_innodb.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4583,7 +4583,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
45834583
share->table_name_length=length;
45844584
share->table_name=(char*) (share+1);
45854585
strmov(share->table_name,table_name);
4586-
if (hash_insert(&innobase_open_tables, (mysql_byte*) share))
4586+
if (my_hash_insert(&innobase_open_tables, (mysql_byte*) share))
45874587
{
45884588
pthread_mutex_unlock(&innobase_mutex);
45894589
my_free((gptr) share,0);

sql/hash_filo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class hash_filo
116116
last_link=last_link->prev_used;
117117
hash_delete(&cache,(byte*) tmp);
118118
}
119-
if (hash_insert(&cache,(byte*) entry))
119+
if (my_hash_insert(&cache,(byte*) entry))
120120
{
121121
if (free_element)
122122
(*free_element)(entry); // This should never happen

sql/item_func.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ class ULL
17421742
pthread_cond_init(&cond,NULL);
17431743
if (key)
17441744
{
1745-
if (hash_insert(&hash_user_locks,(byte*) this))
1745+
if (my_hash_insert(&hash_user_locks,(byte*) this))
17461746
{
17471747
my_free((gptr) key,MYF(0));
17481748
key=0;
@@ -2103,7 +2103,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
21032103
entry->used_query_id=current_thd->query_id;
21042104
entry->type=STRING_RESULT;
21052105
memcpy(entry->name.str, name.str, name.length+1);
2106-
if (hash_insert(hash,(byte*) entry))
2106+
if (my_hash_insert(hash,(byte*) entry))
21072107
{
21082108
my_free((char*) entry,MYF(0));
21092109
return 0;

sql/lock.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
526526
table->locked_by_name=1;
527527
table_list->table=table;
528528

529-
if (hash_insert(&open_cache, (byte*) table))
529+
if (my_hash_insert(&open_cache, (byte*) table))
530530
{
531531
my_free((gptr) table,MYF(0));
532532
DBUG_RETURN(-1);

sql/repl_failsafe.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
177177

178178
pthread_mutex_lock(&LOCK_slave_list);
179179
unregister_slave(thd,0,0);
180-
res= hash_insert(&slave_list, (byte*) si);
180+
res= my_hash_insert(&slave_list, (byte*) si);
181181
pthread_mutex_unlock(&LOCK_slave_list);
182182
return res;
183183

@@ -540,7 +540,7 @@ HOSTS";
540540
goto err;
541541
}
542542
si->server_id = server_id;
543-
hash_insert(&slave_list, (byte*)si);
543+
my_hash_insert(&slave_list, (byte*)si);
544544
}
545545
strmake(si->host, row[1], sizeof(si->host)-1);
546546
si->port = atoi(row[port_ind]);

sql/set_var.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,7 @@ void set_var_init()
19251925
{
19261926
(*var)->name_length= strlen((*var)->name);
19271927
(*var)->option_limits= find_option(my_long_options, (*var)->name);
1928-
hash_insert(&system_variable_hash, (byte*) *var);
1928+
my_hash_insert(&system_variable_hash, (byte*) *var);
19291929
}
19301930
/*
19311931
Special cases

sql/slave.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ int add_table_rule(HASH* h, const char* table_spec)
790790
e->tbl_name = e->db + (dot - table_spec) + 1;
791791
e->key_len = len;
792792
memcpy(e->db, table_spec, len);
793-
(void)hash_insert(h, (byte*)e);
793+
(void)my_hash_insert(h, (byte*)e);
794794
return 0;
795795
}
796796

sql/sql_acl.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ static void init_check_host(void)
10691069
else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
10701070
(uint) strlen(acl_user->host.hostname)))
10711071
{
1072-
if (hash_insert(&acl_check_hosts,(byte*) acl_user))
1072+
if (my_hash_insert(&acl_check_hosts,(byte*) acl_user))
10731073
{ // End of memory
10741074
allow_all_hosts=1; // Should never happen
10751075
DBUG_VOID_RETURN;
@@ -1782,7 +1782,7 @@ class GRANT_TABLE :public Sql_alloc
17821782
privs = cols = 0; /* purecov: deadcode */
17831783
return; /* purecov: deadcode */
17841784
}
1785-
hash_insert(&hash_columns, (byte *) mem_check);
1785+
my_hash_insert(&hash_columns, (byte *) mem_check);
17861786
} while (!col_privs->file->index_next(col_privs->record[0]) &&
17871787
!key_cmp(col_privs,key,0,key_len));
17881788
}
@@ -1944,7 +1944,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
19441944
goto end; /* purecov: inspected */
19451945
}
19461946
GRANT_COLUMN *grant_column = new GRANT_COLUMN(xx->column,privileges);
1947-
hash_insert(&g_t->hash_columns,(byte*) grant_column);
1947+
my_hash_insert(&g_t->hash_columns,(byte*) grant_column);
19481948
}
19491949
}
19501950
table->file->index_end();
@@ -2295,7 +2295,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
22952295
result= -1; /* purecov: deadcode */
22962296
continue; /* purecov: deadcode */
22972297
}
2298-
hash_insert(&column_priv_hash,(byte*) grant_table);
2298+
my_hash_insert(&column_priv_hash,(byte*) grant_table);
22992299
}
23002300

23012301
/* If revoke_grant, calculate the new column privilege for tables_priv */
@@ -2538,7 +2538,7 @@ my_bool grant_init(THD *org_thd)
25382538
{
25392539
GRANT_TABLE *mem_check;
25402540
if (!(mem_check=new GRANT_TABLE(t_table,c_table)) ||
2541-
mem_check->ok() && hash_insert(&column_priv_hash,(byte*) mem_check))
2541+
mem_check->ok() && my_hash_insert(&column_priv_hash,(byte*) mem_check))
25422542
{
25432543
/* This could only happen if we are out memory */
25442544
grant_option= FALSE; /* purecov: deadcode */

sql/sql_base.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
873873
table->version=refresh_version;
874874
table->flush_version=flush_version;
875875
DBUG_PRINT("info", ("inserting table %p into the cache", table));
876-
VOID(hash_insert(&open_cache,(byte*) table));
876+
VOID(my_hash_insert(&open_cache,(byte*) table));
877877
}
878878

879879
table->in_use=thd;

sql/sql_cache.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
823823

824824
Query_cache_query *header = query_block->query();
825825
header->init_n_lock();
826-
if (hash_insert(&queries, (byte*) query_block))
826+
if (my_hash_insert(&queries, (byte*) query_block))
827827
{
828828
refused++;
829829
DBUG_PRINT("qcache", ("insertion in query hash"));
@@ -2044,7 +2044,7 @@ Query_cache::insert_table(uint key_len, char *key,
20442044
Query_cache_block_table *list_root = table_block->table(0);
20452045
list_root->n = 0;
20462046
list_root->next = list_root->prev = list_root;
2047-
if (hash_insert(&tables, (const byte *) table_block))
2047+
if (my_hash_insert(&tables, (const byte *) table_block))
20482048
{
20492049
DBUG_PRINT("qcache", ("Can't insert table to hash"));
20502050
// write_block_data return locked block

sql/sql_parse.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
161161
if (max_user_connections && mqh->connections > max_user_connections)
162162
uc->user_resources.connections = max_user_connections;
163163
uc->intime=thd->thr_create_time;
164-
if (hash_insert(&hash_user_connections, (byte*) uc))
164+
if (my_hash_insert(&hash_user_connections, (byte*) uc))
165165
{
166166
my_free((char*) uc,0);
167167
send_error(thd, 0, NullS); // Out of memory

sql/sql_select.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -7196,7 +7196,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
71967196
goto err;
71977197
}
71987198
else
7199-
(void) hash_insert(&hash, key_pos-key_length);
7199+
(void) my_hash_insert(&hash, key_pos-key_length);
72007200
key_pos+=extra_length;
72017201
}
72027202
my_free((char*) key_buffer,MYF(0));

sql/sql_udf.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
345345
tmp->returns = ret;
346346
tmp->type = type;
347347
tmp->usage_count=1;
348-
if (hash_insert(&udf_hash,(byte*) tmp))
348+
if (my_hash_insert(&udf_hash,(byte*) tmp))
349349
return 0;
350350
using_udf_functions=1;
351351
return tmp;

sql/table.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
459459
if (outparam->timestamp_field == reg_field)
460460
outparam->timestamp_field_offset=i;
461461
if (use_hash)
462-
(void) hash_insert(&outparam->name_hash,(byte*) *field_ptr); // Will never fail
462+
(void) my_hash_insert(&outparam->name_hash,(byte*) *field_ptr); // Will never fail
463463
}
464464
*field_ptr=0; // End marker
465465

tools/mysqlmanager.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ HANDLE_DECL(handle_def_exec)
818818
update_req_len(e);
819819
hash_delete(&exec_hash,(byte*)old_e);
820820
}
821-
hash_insert(&exec_hash,(byte*)e);
821+
my_hash_insert(&exec_hash,(byte*)e);
822822
pthread_mutex_unlock(&lock_exec_hash);
823823
client_msg(&thd->net,MANAGER_OK,"Exec definition created");
824824
return 0;
@@ -1666,7 +1666,7 @@ static void init_user_hash()
16661666
}
16671667
else
16681668
{
1669-
hash_insert(&user_hash,(gptr)u);
1669+
my_hash_insert(&user_hash,(gptr)u);
16701670
}
16711671
}
16721672
my_fclose(f, MYF(0));

0 commit comments

Comments
 (0)