From 9c3632fb8316da7f3230940586c081e30e0f8ce3 Mon Sep 17 00:00:00 2001 From: "konstantin@oak.local" <> Date: Sun, 23 Nov 2003 17:34:36 +0300 Subject: [PATCH] Cleanups: - unused variable THD::con_root removed - we don't need to bzero(&warn_root) just before init_alloc_root(&warn_root) - we don't need to bzero(&transaction.mem_root) because we bzero(&transaction) later in THD::THD - we don't need to free thd->mem_root thd->transaction.mem_root in handle_one_connection because they are freed in THD::~THD which is called in end_thread later --- sql/sql_class.cc | 4 ---- sql/sql_class.h | 1 - sql/sql_parse.cc | 3 --- 3 files changed, 8 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 32402cb5d7c..e2af8e3cb1b 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -151,9 +151,6 @@ THD::THD():user_time(0), is_fatal_error(0), init(); /* Initialize sub structures */ bzero((char*) &mem_root,sizeof(mem_root)); - bzero((char*) &transaction.mem_root,sizeof(transaction.mem_root)); - bzero((char*) &con_root,sizeof(con_root)); - bzero((char*) &warn_root,sizeof(warn_root)); init_alloc_root(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE); user_connect=(USER_CONN *)0; hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, @@ -355,7 +352,6 @@ THD::~THD() safeFree(db); safeFree(ip); free_root(&mem_root,MYF(0)); - free_root(&con_root,MYF(0)); free_root(&warn_root,MYF(0)); free_root(&transaction.mem_root,MYF(0)); mysys_var=0; // Safety (shouldn't be needed) diff --git a/sql/sql_class.h b/sql/sql_class.h index bc5441dbab5..f9d74f8b4da 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -452,7 +452,6 @@ public: LEX main_lex; LEX *lex; // parse tree descriptor MEM_ROOT mem_root; // 1 command-life memory pool - MEM_ROOT con_root; // connection-life memory MEM_ROOT warn_root; // For warnings and errors Protocol *protocol; // Current protocol Protocol_simple protocol_simple; // Normal protocol diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c4a1251cd3a..7afc268b270 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -957,7 +957,6 @@ pthread_handler_decl(handle_one_connection,arg) } if (thd->user_connect) decrease_user_connections(thd->user_connect); - free_root(&thd->mem_root,MYF(0)); if (net->error && net->vio != 0 && net->report_error) { if (!thd->killed && thd->variables.log_warnings) @@ -1537,8 +1536,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #endif close_connection(thd, 0, 1); close_thread_tables(thd); // Free before kill - free_root(&thd->mem_root,MYF(0)); - free_root(&thd->transaction.mem_root,MYF(0)); kill_mysql(); error=TRUE; break;