From 9b41c7532d18b04d2f430932ad916886c77fbff6 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Wed, 14 Oct 2009 20:37:38 +0400 Subject: Backport of: ---------------------------------------------------------- revno: 2617.22.5 committer: Konstantin Osipov 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. --- sql/sql_servers.cc | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'sql/sql_servers.cc') diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 33058887952..e8fa3d984a7 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -120,8 +120,8 @@ bool servers_init(bool dont_read_servers_table) DBUG_RETURN(TRUE); /* initialise our servers cache */ - if (hash_init(&servers_cache, system_charset_info, 32, 0, 0, - (hash_get_key) servers_cache_get_key, 0, 0)) + if (my_hash_init(&servers_cache, system_charset_info, 32, 0, 0, + (my_hash_get_key) servers_cache_get_key, 0, 0)) { return_val= TRUE; /* we failed, out of memory? */ goto end; @@ -646,9 +646,10 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options) server_options->server_name_length)); - if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache, - (uchar*) server_options->server_name, - server_options->server_name_length))) + if (!(server= (FOREIGN_SERVER *) + my_hash_search(&servers_cache, + (uchar*) server_options->server_name, + server_options->server_name_length))) { DBUG_PRINT("info", ("server_name %s length %d not found!", server_options->server_name, @@ -663,7 +664,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options) server->server_name, server->server_name_length)); - VOID(hash_delete(&servers_cache, (uchar*) server)); + VOID(my_hash_delete(&servers_cache, (uchar*) server)); error= 0; @@ -770,7 +771,7 @@ int update_server_record_in_cache(FOREIGN_SERVER *existing, /* delete the existing server struct from the server cache */ - VOID(hash_delete(&servers_cache, (uchar*)existing)); + VOID(my_hash_delete(&servers_cache, (uchar*)existing)); /* Insert the altered server struct into the server cache @@ -965,8 +966,8 @@ int create_server(THD *thd, LEX_SERVER_OPTIONS *server_options) rw_wrlock(&THR_LOCK_servers); /* hit the memory first */ - if (hash_search(&servers_cache, (uchar*) server_options->server_name, - server_options->server_name_length)) + if (my_hash_search(&servers_cache, (uchar*) server_options->server_name, + server_options->server_name_length)) goto end; @@ -1014,9 +1015,9 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options) rw_wrlock(&THR_LOCK_servers); - if (!(existing= (FOREIGN_SERVER *) hash_search(&servers_cache, - (uchar*) name.str, - name.length))) + if (!(existing= (FOREIGN_SERVER *) my_hash_search(&servers_cache, + (uchar*) name.str, + name.length))) goto end; altered= (FOREIGN_SERVER *)alloc_root(&mem, @@ -1195,7 +1196,7 @@ prepare_server_struct_for_update(LEX_SERVER_OPTIONS *server_options, void servers_free(bool end) { DBUG_ENTER("servers_free"); - if (!hash_inited(&servers_cache)) + if (!my_hash_inited(&servers_cache)) DBUG_VOID_RETURN; if (!end) { @@ -1205,7 +1206,7 @@ void servers_free(bool end) } rwlock_destroy(&THR_LOCK_servers); free_root(&mem,MYF(0)); - hash_free(&servers_cache); + my_hash_free(&servers_cache); DBUG_VOID_RETURN; } @@ -1286,9 +1287,9 @@ FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, DBUG_PRINT("info", ("locking servers_cache")); rw_rdlock(&THR_LOCK_servers); - if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache, - (uchar*) server_name, - server_name_length))) + if (!(server= (FOREIGN_SERVER *) my_hash_search(&servers_cache, + (uchar*) server_name, + server_name_length))) { DBUG_PRINT("info", ("server_name %s length %u not found!", server_name, (unsigned) server_name_length)); -- cgit v1.2.1