From 44086a625ba427522c7984f71a94f61d22122f3b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2005 03:12:42 +0300 Subject: Cleanups and optimization during review of new code mysql-test/t/kill.test: Moved --disable_reconnect earlier to avoid race condition sql/sql_help.cc: Cleanup during review of new code (Moved variable definitions first in function sql/sql_insert.cc: Cleanup during review of new code sql/sql_lex.cc: Cleanup during review of new code sql/sql_parse.cc: Cleanup during review of new code Changed potential problem with previous_table_ref where it dependent that TABLE_LIST first element would be next_local Rearanged code in add_table_to_list() to remove extra if Combined 2 calls to calloc() to one sql/sql_view.cc: Remove extra indentation level Combined common 'on error' exit sql/sql_yacc.yy: Fixed comment style sql/table.cc: Cleanup during review of new code - Changed while() loops to for() loop (to make code more readable) - Removed not needed initialization of variables - Removed not needed 'else' cases - Removed trivial ASSERT's that was checked by previous code - Moved comment setting last in Natural_join_column::check_grants() --- sql/sql_help.cc | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'sql/sql_help.cc') diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 0a89c3a29d7..799758f7d1e 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -623,38 +623,37 @@ bool mysqld_help(THD *thd, const char *mask) Protocol *protocol= thd->protocol; SQL_SELECT *select; st_find_field used_fields[array_elements(init_used_fields)]; - DBUG_ENTER("mysqld_help"); - TABLE_LIST *leaves= 0; TABLE_LIST tables[4]; + List topics_list, categories_list, subcategories_list; + String name, description, example; + int count_topics, count_categories, error; + uint mlen= strlen(mask); + size_t i; + MEM_ROOT *mem_root= thd->mem_root; + DBUG_ENTER("mysqld_help"); + bzero((gptr)tables,sizeof(tables)); tables[0].alias= tables[0].table_name= (char*) "help_topic"; tables[0].lock_type= TL_READ; - tables[0].next_global= tables[0].next_local= &tables[1]; - tables[0].next_name_resolution_table= tables[0].next_local; + tables[0].next_global= tables[0].next_local= + tables[0].next_name_resolution_table= &tables[1]; tables[1].alias= tables[1].table_name= (char*) "help_category"; tables[1].lock_type= TL_READ; - tables[1].next_global= tables[1].next_local= &tables[2]; - tables[1].next_name_resolution_table= tables[1].next_local; + tables[1].next_global= tables[1].next_local= + tables[1].next_name_resolution_table= &tables[2]; tables[2].alias= tables[2].table_name= (char*) "help_relation"; tables[2].lock_type= TL_READ; - tables[2].next_global= tables[2].next_local= &tables[3]; - tables[2].next_name_resolution_table= tables[2].next_local; + tables[2].next_global= tables[2].next_local= + tables[2].next_name_resolution_table= &tables[3]; tables[3].alias= tables[3].table_name= (char*) "help_keyword"; tables[3].lock_type= TL_READ; tables[0].db= tables[1].db= tables[2].db= tables[3].db= (char*) "mysql"; - List topics_list, categories_list, subcategories_list; - String name, description, example; - int count_topics, count_categories, error; - uint mlen= strlen(mask); - MEM_ROOT *mem_root= thd->mem_root; - if (open_and_lock_tables(thd, tables)) goto error; /* Init tables and fields to be usable from items - tables do not contain VIEWs => we can pass 0 as conds */ setup_tables(thd, &thd->lex->select_lex.context, @@ -663,7 +662,6 @@ bool mysqld_help(THD *thd, const char *mask) memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields)); if (init_fields(thd, tables, used_fields, array_elements(used_fields))) goto error; - size_t i; for (i=0; ifile->init_table_handle_for_HANDLER(); -- cgit v1.2.1