From ba4c3b070afca4f649f315a76017eac928a091e5 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 6 Jul 2010 23:41:59 +0100 Subject: BUG#54744: valgrind reports leak for mysqlbinlog The server was not cleaning up dbug allocated memory before exiting. This is not a real problem, as this memory would be deallocated anyway. Nonetheless, we improve the mysqlbinlog exit procedure, wrt to memory book-keeping, when no parameter is given. To fix this, we deploy a call to my_thread_end() before the thread exits, which will also free pending dbug related allocated blocks. --- client/mysqlbinlog.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'client') diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9d85e24d03f..879409515c2 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,6 +2032,7 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); + my_thread_end(); exit(1); } -- cgit v1.2.1 From d4cd1f843da60019664dfad2b0ad6987f82f01c6 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 8 Jul 2010 17:30:19 +0100 Subject: Revert patch for BUG#54744. --- client/mysqlbinlog.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'client') diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 879409515c2..9d85e24d03f 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,7 +2032,6 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); - my_thread_end(); exit(1); } -- cgit v1.2.1 From a10ae35328ec800eff63c0bbb06d279e44c0a5a1 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 8 Jul 2010 18:20:08 -0300 Subject: Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. --- client/completion_hash.cc | 3 +- client/mysql.cc | 48 +++++++++++----------- client/mysqladmin.cc | 12 +++--- client/mysqlbinlog.cc | 34 ++++++++-------- client/mysqlcheck.c | 12 +++--- client/mysqldump.c | 29 +++++-------- client/mysqlimport.c | 6 +-- client/mysqlshow.c | 7 ++-- client/mysqlslap.c | 38 ++++++++--------- client/mysqltest.cc | 102 +++++++++++++++++++++------------------------- client/readline.cc | 8 ++-- client/sql_string.h | 2 +- 12 files changed, 138 insertions(+), 163 deletions(-) (limited to 'client') diff --git a/client/completion_hash.cc b/client/completion_hash.cc index cd0ea17dfaf..dc7f0329db8 100644 --- a/client/completion_hash.cc +++ b/client/completion_hash.cc @@ -22,7 +22,6 @@ #include #include -#undef SAFEMALLOC // Speed things up #include #include "completion_hash.h" @@ -213,7 +212,7 @@ void completion_hash_clean(HashTable *ht) void completion_hash_free(HashTable *ht) { completion_hash_clean(ht); - my_free(ht->arBuckets, MYF(0)); + my_free(ht->arBuckets); } diff --git a/client/mysql.cc b/client/mysql.cc index 58ef51f3fff..d64bd8f686a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1205,7 +1205,7 @@ int main(int argc,char *argv[]) strncmp(link_name, "/dev/null", 10) == 0) { /* The .mysql_history file is a symlink to /dev/null, don't use it */ - my_free(histfile, MYF(MY_ALLOW_ZERO_PTR)); + my_free(histfile); histfile= 0; } } @@ -1266,23 +1266,23 @@ sig_handler mysql_end(int sig) glob_buffer.free(); old_buffer.free(); processed_prompt.free(); - my_free(server_version,MYF(MY_ALLOW_ZERO_PTR)); - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR)); - my_free(histfile,MYF(MY_ALLOW_ZERO_PTR)); - my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR)); - my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); - my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); - my_free(current_user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(full_username,MYF(MY_ALLOW_ZERO_PTR)); - my_free(part_username,MYF(MY_ALLOW_ZERO_PTR)); - my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR)); + my_free(server_version); + my_free(opt_password); + my_free(opt_mysql_unix_port); + my_free(histfile); + my_free(histfile_tmp); + my_free(current_db); + my_free(current_host); + my_free(current_user); + my_free(full_username); + my_free(part_username); + my_free(default_prompt); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif - my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_prompt); while (embedded_server_arg_count > 1) - my_free(embedded_server_args[--embedded_server_arg_count],MYF(0)); + my_free(embedded_server_args[--embedded_server_arg_count]); mysql_server_end(); free_defaults(defaults_argv); my_end(my_end_arg); @@ -1736,7 +1736,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start= argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password= my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; // Destroy argument if (*start) @@ -1833,7 +1833,7 @@ static int get_options(int argc, char **argv) if (argc == 1) { skip_updates= 0; - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db= my_strdup(*argv, MYF(MY_WME)); } if (tty_password) @@ -2731,7 +2731,7 @@ static void get_current_db() { MYSQL_RES *res; - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db= NULL; /* In case of error below current_db will be NULL */ if (!mysql_query(&mysql, "SELECT DATABASE()") && @@ -4023,12 +4023,12 @@ com_connect(String *buffer, char *line) tmp= get_arg(buff, 0); if (tmp && *tmp) { - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db= my_strdup(tmp, MYF(MY_WME)); tmp= get_arg(buff, 1); if (tmp) { - my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_host); current_host=my_strdup(tmp,MYF(MY_WME)); } } @@ -4200,7 +4200,7 @@ com_use(String *buffer __attribute__((unused)), char *line) if (mysql_select_db(&mysql,tmp)) return put_error(&mysql); } - my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_db); current_db=my_strdup(tmp,MYF(MY_WME)); #ifdef HAVE_READLINE if (select_db > 1) @@ -4952,8 +4952,8 @@ static void add_int_to_prompt(int toadd) static void init_username() { - my_free(full_username,MYF(MY_ALLOW_ZERO_PTR)); - my_free(part_username,MYF(MY_ALLOW_ZERO_PTR)); + my_free(full_username); + my_free(part_username); MYSQL_RES *result; LINT_INIT(result); @@ -4971,7 +4971,7 @@ static int com_prompt(String *buffer, char *line) { char *ptr=strchr(line, ' '); prompt_counter = 0; - my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR)); + my_free(current_prompt); current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME)); if (!ptr) tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 64371224e2b..bf0dec01d2f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -236,7 +236,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -448,10 +448,10 @@ int main(int argc,char *argv[]) } /* got connection */ mysql_close(&mysql); - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); + my_free(user); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif free_defaults(save_argv); my_end(my_end_arg); @@ -1008,8 +1008,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) /* free up memory from prompted password */ if (typed_password != argv[1]) { - my_free(typed_password,MYF(MY_ALLOW_ZERO_PTR)); - my_free(verified,MYF(MY_ALLOW_ZERO_PTR)); + my_free(typed_password); + my_free(verified); } argc--; argv++; break; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9d85e24d03f..d8b57381904 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -68,20 +68,20 @@ TYPELIB base64_output_mode_typelib= { array_elements(base64_output_mode_names) - 1, "", base64_output_mode_names, NULL }; static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC; -static const char *opt_base64_output_mode_str= NullS; -static const char* database= 0; +static char *opt_base64_output_mode_str= NullS; +static char* database= 0; static my_bool force_opt= 0, short_form= 0, remote_opt= 0; static my_bool debug_info_flag, debug_check_flag; static my_bool force_if_open_opt= 1; static ulonglong offset = 0; -static const char* host = 0; +static char* host = 0; static int port= 0; static uint my_end_arg; static const char* sock= 0; #ifdef HAVE_SMEM static char *shared_memory_base_name= 0; #endif -static const char* user = 0; +static char* user = 0; static char* pass = 0; static char *charset= 0; @@ -96,7 +96,7 @@ static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX; static ulonglong rec_count= 0; static short binlog_flags = 0; static MYSQL* mysql = NULL; -static const char* dirname_for_local_load= 0; +static char* dirname_for_local_load= 0; /** Pointer to the Format_description_log_event of the currently active binlog. @@ -191,7 +191,7 @@ public: int init() { return init_dynamic_array(&file_names, sizeof(File_name_record), - 100,100 CALLER_INFO); + 100, 100); } void init_by_dir_name(const char *dir) @@ -213,7 +213,7 @@ public: { if (ptr->fname) { - my_free(ptr->fname, MYF(MY_WME)); + my_free(ptr->fname); delete ptr->event; bzero((char *)ptr, sizeof(File_name_record)); } @@ -442,7 +442,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, { error("Could not construct local filename %s%s.", target_dir_name,bname); - my_free(fname, MYF(0)); + my_free(fname); delete ce; DBUG_RETURN(ERROR_STOP); } @@ -458,7 +458,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, if (set_dynamic(&file_names, (uchar*)&rec, file_id)) { error("Out of memory."); - my_free(fname, MYF(0)); + my_free(fname); delete ce; DBUG_RETURN(ERROR_STOP); } @@ -822,7 +822,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, */ convert_path_to_forward_slashes((char*) ce->fname); ce->print(result_file, print_event_info, TRUE); - my_free((char*)ce->fname,MYF(MY_WME)); + my_free((void*)ce->fname); delete ce; } else @@ -887,7 +887,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, } if (fname) - my_free(fname, MYF(MY_WME)); + my_free(fname); break; } case TABLE_MAP_EVENT: @@ -1222,11 +1222,11 @@ static void warning(const char *format,...) */ static void cleanup() { - my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) database, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) host, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) user, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) dirname_for_local_load, MYF(MY_ALLOW_ZERO_PTR)); + my_free(pass); + my_free(database); + my_free(host); + my_free(user); + my_free(dirname_for_local_load); delete glob_description_event; if (mysql) @@ -1306,7 +1306,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), argument= (char*) ""; // Don't require password if (argument) { - my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); + my_free(pass); char *start=argument; pass= my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 1fc9f179895..2c9c563e17f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -291,7 +291,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start = argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password = my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -470,7 +470,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) } *--end = 0; handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1)); - my_free(table_names_comma_sep, MYF(0)); + my_free(table_names_comma_sep); } else for (; tables > 0; tables--, table_names++) @@ -569,7 +569,7 @@ static int process_all_tables_in_db(char *database) *--end = 0; if (tot_length) handle_request_for_tables(tables + 1, tot_length - 1); - my_free(tables, MYF(0)); + my_free(tables); } else { @@ -727,7 +727,7 @@ static int handle_request_for_tables(char *tables, uint length) return 1; } print_result(); - my_free(query, MYF(0)); + my_free(query); return 0; } @@ -899,9 +899,9 @@ int main(int argc, char **argv) dbDisconnect(current_host); if (opt_auto_repair) delete_dynamic(&tables4repair); - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif my_end(my_end_arg); return(first_error!=0); diff --git a/client/mysqldump.c b/client/mysqldump.c index 2d92f0891eb..6d294153c54 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -715,12 +715,6 @@ static void write_footer(FILE *sql_file) } /* write_footer */ -static void free_table_ent(char *key) -{ - my_free(key, MYF(0)); -} - - uchar* get_table_key(const char *entry, size_t *length, my_bool not_used __attribute__((unused))) { @@ -745,7 +739,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -905,8 +899,7 @@ static int get_options(int *argc, char ***argv) defaults_argv= *argv; if (my_hash_init(&ignore_table, charset_info, 16, 0, 0, - (my_hash_get_key) get_table_key, - (my_hash_free_key) free_table_ent, 0)) + (my_hash_get_key) get_table_key, my_free, 0)) return(EX_EOM); /* Don't copy internal log tables */ if (my_hash_insert(&ignore_table, @@ -1420,7 +1413,7 @@ static void free_resources() { if (md_result_file && md_result_file != stdout) my_fclose(md_result_file, MYF(0)); - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); if (my_hash_inited(&ignore_table)) my_hash_free(&ignore_table); if (extended_insert) @@ -1534,7 +1527,7 @@ static void unescape(FILE *file,char *pos,uint length) fputs(tmp, file); fputc('\'', file); check_io(file); - my_free(tmp, MYF(MY_WME)); + my_free(tmp); DBUG_VOID_RETURN; } /* unescape */ @@ -2201,7 +2194,7 @@ static uint dump_routines_for_db(char *db) } } - my_free(query_str, MYF(MY_ALLOW_ZERO_PTR)); + my_free(query_str); } } /* end of routine printing */ mysql_free_result(routine_res); @@ -2374,12 +2367,12 @@ static uint get_table_structure(char *table, char *db, char *table_type, if (mysql_errno(mysql) == ER_VIEW_INVALID) fprintf(sql_file, "\n-- failed on view %s: %s\n\n", result_table, scv_buff ? scv_buff : ""); - my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(scv_buff); DBUG_RETURN(0); } else - my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(scv_buff); if (mysql_num_rows(result)) { @@ -2855,7 +2848,7 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs, DBUG_RETURN(TRUE); } - my_free(query_str, MYF(MY_ALLOW_ZERO_PTR)); + my_free(query_str); } DBUG_RETURN(FALSE); @@ -4073,7 +4066,7 @@ static int dump_all_tables_in_db(char *database) if (include_table((uchar*) hash_key, end - hash_key)) { dump_table(table,database); - my_free(order_by, MYF(MY_ALLOW_ZERO_PTR)); + my_free(order_by); order_by= 0; if (opt_dump_triggers && ! opt_xml && mysql_get_server_version(mysql) >= 50009) @@ -4345,7 +4338,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) dump_routines_for_db(db); } free_root(&root, MYF(0)); - my_free(order_by, MYF(MY_ALLOW_ZERO_PTR)); + my_free(order_by); order_by= 0; if (opt_xml) { @@ -5258,7 +5251,7 @@ int main(int argc, char **argv) goto err; #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif /* No reason to explicitely COMMIT the transaction, neither to explicitely diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 3bf17cb1df7..fdb521b9cf8 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -230,7 +230,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -684,9 +684,9 @@ int main(int argc, char **argv) exitcode= error; db_disconnect(current_host, mysql); } - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif free_defaults(argv_to_free); my_end(my_end_arg); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index d8561d13b81..76f9048e09e 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -149,10 +149,9 @@ int main(int argc, char **argv) break; } mysql_close(&mysql); /* Close & free connection */ - if (opt_password) - my_free(opt_password,MYF(0)); + my_free(opt_password); #ifdef HAVE_SMEM - my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif my_end(my_end_arg); exit(error ? 1 : 0); @@ -292,7 +291,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start=argument; - my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password=my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 714a8cb9039..e411b096d68 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -399,10 +399,8 @@ int main(int argc, char **argv) mysql_close(&mysql); /* Close & free connection */ /* now free all the strings we created */ - if (opt_password) - my_free(opt_password, MYF(0)); - - my_free(concurrency, MYF(0)); + my_free(opt_password); + my_free(concurrency); statement_cleanup(create_statements); statement_cleanup(query_statements); @@ -411,8 +409,7 @@ int main(int argc, char **argv) option_cleanup(engine_options); #ifdef HAVE_SMEM - if (shared_memory_base_name) - my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(shared_memory_base_name); #endif free_defaults(defaults_argv); my_end(my_end_arg); @@ -504,7 +501,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr) if (opt_csv_str) print_conclusions_csv(&conclusion); - my_free(head_sptr, MYF(0)); + my_free(head_sptr); } @@ -721,7 +718,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), if (argument) { char *start= argument; - my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_password); opt_password= my_strdup(argument,MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) @@ -1367,7 +1364,7 @@ get_options(int *argc,char ***argv) tmp_string[sbuf.st_size]= '\0'; my_close(data_file,MYF(0)); parse_delimiter(tmp_string, &create_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (create_string) { @@ -1396,7 +1393,7 @@ get_options(int *argc,char ***argv) if (user_supplied_query) actual_queries= parse_delimiter(tmp_string, &query_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (user_supplied_query) { @@ -1427,7 +1424,7 @@ get_options(int *argc,char ***argv) if (user_supplied_pre_statements) (void)parse_delimiter(tmp_string, &pre_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (user_supplied_pre_statements) { @@ -1458,7 +1455,7 @@ get_options(int *argc,char ***argv) if (user_supplied_post_statements) (void)parse_delimiter(tmp_string, &post_statements, delimiter[0]); - my_free(tmp_string, MYF(0)); + my_free(tmp_string); } else if (user_supplied_post_statements) { @@ -1555,9 +1552,9 @@ drop_primary_key_list(void) if (primary_keys_number_of) { for (counter= 0; counter < primary_keys_number_of; counter++) - my_free(primary_keys[counter], MYF(0)); + my_free(primary_keys[counter]); - my_free(primary_keys, MYF(0)); + my_free(primary_keys); } return 0; @@ -2154,11 +2151,9 @@ option_cleanup(option_string *stmt) for (ptr= stmt; ptr; ptr= nptr) { nptr= ptr->next; - if (ptr->string) - my_free(ptr->string, MYF(0)); - if (ptr->option) - my_free(ptr->option, MYF(0)); - my_free(ptr, MYF(0)); + my_free(ptr->string); + my_free(ptr->option); + my_free(ptr); } } @@ -2172,9 +2167,8 @@ statement_cleanup(statement *stmt) for (ptr= stmt; ptr; ptr= nptr) { nptr= ptr->next; - if (ptr->string) - my_free(ptr->string, MYF(0)); - my_free(ptr, MYF(0)); + my_free(ptr->string); + my_free(ptr); } } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 75b23ea9af7..1d821c18111 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -84,10 +84,10 @@ static my_bool get_one_option(int optid, const struct my_option *, C_MODE_END enum { - OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION, - OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, - OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS, - OPT_LOG_DIR, OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION + OPT_PS_PROTOCOL=OPT_MAX_CLIENT_OPTION, OPT_SP_PROTOCOL, + OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, OPT_MAX_CONNECT_RETRIES, + OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS, OPT_LOG_DIR, + OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION }; static int record= 0, opt_sleep= -1; @@ -156,7 +156,7 @@ static struct st_block *cur_block, *block_stack_end; struct st_test_file { FILE* file; - const char *file_name; + char *file_name; uint lineno; /* Current line in file */ }; @@ -1106,9 +1106,9 @@ void close_connections() mysql_close(&next_con->mysql); if (next_con->util_mysql) mysql_close(next_con->util_mysql); - my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(next_con->name); } - my_free(connections, MYF(MY_WME)); + my_free(connections); DBUG_VOID_RETURN; } @@ -1137,7 +1137,7 @@ void close_files() DBUG_PRINT("info", ("closing file: %s", cur_file->file_name)); fclose(cur_file->file); } - my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cur_file->file_name); cur_file->file_name= 0; } DBUG_VOID_RETURN; @@ -1157,22 +1157,22 @@ void free_used_memory() for (i= 0 ; i < q_lines.elements ; i++) { struct st_command **q= dynamic_element(&q_lines, i, struct st_command**); - my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR)); + my_free((*q)->query_buf); if ((*q)->content.str) dynstr_free(&(*q)->content); - my_free((*q),MYF(0)); + my_free((*q)); } for (i= 0; i < 10; i++) { if (var_reg[i].alloced_len) - my_free(var_reg[i].str_val, MYF(MY_WME)); + my_free(var_reg[i].str_val); } while (embedded_server_arg_count > 1) - my_free(embedded_server_args[--embedded_server_arg_count],MYF(0)); + my_free(embedded_server_args[--embedded_server_arg_count]); delete_dynamic(&q_lines); dynstr_free(&ds_res); free_all_replace(); - my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_pass); free_defaults(default_argv); free_re(); #ifdef __WIN__ @@ -1933,9 +1933,10 @@ static uchar *get_var_key(const uchar* var, size_t *len, static void var_free(void *v) { - my_free(((VAR*) v)->str_val, MYF(MY_WME)); - if (((VAR*)v)->alloced) - my_free(v, MYF(MY_WME)); + VAR *var= (VAR*) v; + my_free(var->str_val); + if (var->alloced) + my_free(var); } C_MODE_END @@ -4824,7 +4825,7 @@ void do_close_connection(struct st_command *command) con->util_mysql= 0; con->pending= FALSE; - my_free(con->name, MYF(0)); + my_free(con->name); /* When the connection is closed set name to "-closed_connection-" @@ -5491,7 +5492,7 @@ int read_line(char *buf, int size) fclose(cur_file->file); cur_file->file= 0; } - my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cur_file->file_name); cur_file->file_name= 0; if (cur_file == file_stack) { @@ -5967,9 +5968,6 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"silent", 's', "Suppress all normal output. Synonym for --quiet.", &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-safemalloc", OPT_SKIP_SAFEMALLOC, - "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG, - 0, 0, 0, 0, 0, 0}, {"sleep", 'T', "Always sleep this many seconds on sleep commands.", &opt_sleep, &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0, 0, 0, 0}, @@ -6125,7 +6123,7 @@ get_one_option(int optid, const struct my_option *, char *argument) argument= (char*) ""; // Don't require password if (argument) { - my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_pass); opt_pass= my_strdup(argument, MYF(MY_FAE)); while (*argument) *argument++= 'x'; /* Destroy argument */ tty_password= 0; @@ -6158,11 +6156,6 @@ get_one_option(int optid, const struct my_option *, char *argument) case 'F': read_embedded_server_arguments(argument); break; - case OPT_SKIP_SAFEMALLOC: -#ifdef SAFEMALLOC - sf_malloc_quick=1; -#endif - break; case OPT_RESULT_FORMAT_VERSION: set_result_format_version(opt_result_format_version); break; @@ -6321,7 +6314,7 @@ void init_win_path_patterns() /* Don't insert zero length strings in patterns array */ if (strlen(p) == 0) { - my_free(p, MYF(0)); + my_free(p); continue; } @@ -6345,7 +6338,7 @@ void free_win_path_patterns() for (i=0 ; i < patterns.elements ; i++) { const char** pattern= dynamic_element(&patterns, i, const char**); - my_free((char*) *pattern, MYF(0)); + my_free(*pattern); } delete_dynamic(&patterns); } @@ -6538,12 +6531,12 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, for (i= 0; i < num_fields; i++) { /* Free data for output */ - my_free(my_bind[i].buffer, MYF(MY_WME | MY_FAE)); + my_free(my_bind[i].buffer); } /* Free array with bind structs, lengths and NULL flags */ - my_free(my_bind , MYF(MY_WME | MY_FAE)); - my_free(length , MYF(MY_WME | MY_FAE)); - my_free(is_null , MYF(MY_WME | MY_FAE)); + my_free(my_bind); + my_free(length); + my_free(is_null); } @@ -8489,11 +8482,11 @@ void do_get_replace_column(struct st_command *command) if (!*from) die("Wrong number of arguments to replace_column in '%s'", command->query); to= get_string(&buff, &from, command); - my_free(replace_column[column_number-1], MY_ALLOW_ZERO_PTR); + my_free(replace_column[column_number-1]); replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE)); set_if_bigger(max_replace_column, column_number); } - my_free(start, MYF(0)); + my_free(start); command->last_argument= command->end; DBUG_VOID_RETURN; @@ -8507,7 +8500,7 @@ void free_replace_column() { if (replace_column[i]) { - my_free(replace_column[i], 0); + my_free(replace_column[i]); replace_column[i]= 0; } } @@ -8588,7 +8581,7 @@ void do_get_replace(struct st_command *command) die("Can't initialize replace from '%s'", command->query); free_pointer_array(&from_array); free_pointer_array(&to_array); - my_free(start, MYF(0)); + my_free(start); command->last_argument= command->end; DBUG_VOID_RETURN; } @@ -8597,11 +8590,8 @@ void do_get_replace(struct st_command *command) void free_replace() { DBUG_ENTER("free_replace"); - if (glob_replace) - { - my_free(glob_replace,MYF(0)); - glob_replace=0; - } + my_free(glob_replace); + glob_replace= NULL; DBUG_VOID_RETURN; } @@ -8821,7 +8811,7 @@ struct st_replace_regex* init_replace_regex(char* expr) return res; err: - my_free(res,0); + my_free(res); die("Error parsing replace_regex \"%s\"", expr); return 0; } @@ -8913,9 +8903,9 @@ void free_replace_regex() if (glob_replace_regex) { delete_dynamic(&glob_replace_regex->regex_arr); - my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR)); - my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR)); - my_free(glob_replace_regex,MYF(0)); + my_free(glob_replace_regex->even_buf); + my_free(glob_replace_regex->odd_buf); + my_free(glob_replace_regex); glob_replace_regex=0; } } @@ -9110,7 +9100,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, str_p= str_end; } } - my_free(subs, MYF(0)); + my_free(subs); my_regfree(&r); *res_p= 0; *buf_p= buf; @@ -9242,7 +9232,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count, if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME)))) { free_sets(&sets); - my_free(found_set,MYF(0)); + my_free(found_set); DBUG_RETURN(0); } @@ -9437,9 +9427,9 @@ REPLACE *init_replace(char * *from, char * *to,uint count, replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1)); } } - my_free(follow,MYF(0)); + my_free(follow); free_sets(&sets); - my_free(found_set,MYF(0)); + my_free(found_set); DBUG_PRINT("exit",("Replace table has %d states",sets.count)); DBUG_RETURN(replace); } @@ -9455,7 +9445,7 @@ int init_sets(REP_SETS *sets,uint states) if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits* SET_MALLOC_HUNC,MYF(MY_WME)))) { - my_free(sets->set,MYF(0)); + my_free(sets->set); return 1; } return 0; @@ -9516,8 +9506,8 @@ void free_last_set(REP_SETS *sets) void free_sets(REP_SETS *sets) { - my_free(sets->set_buffer,MYF(0)); - my_free(sets->bit_buffer,MYF(0)); + my_free(sets->set_buffer); + my_free(sets->bit_buffer); return; } @@ -9657,7 +9647,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD), MYF(MY_WME)))) { - my_free((char*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); DBUG_RETURN (-1); } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ @@ -9718,9 +9708,9 @@ void free_pointer_array(POINTER_ARRAY *pa) if (pa->typelib.count) { pa->typelib.count=0; - my_free((char*) pa->typelib.type_names,MYF(0)); + my_free(pa->typelib.type_names); pa->typelib.type_names=0; - my_free(pa->str,MYF(0)); + my_free(pa->str); } } /* free_pointer_array */ diff --git a/client/readline.cc b/client/readline.cc index 73ce7c3b8c7..5c1a9951d9b 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -35,7 +35,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) return 0; if (init_line_buffer(line_buff,my_fileno(file),IO_SIZE,max_size)) { - my_free(line_buff,MYF(0)); + my_free(line_buff); return 0; } return line_buff; @@ -63,8 +63,8 @@ void batch_readline_end(LINE_BUFFER *line_buff) { if (line_buff) { - my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR)); - my_free(line_buff,MYF(0)); + my_free(line_buff->buffer); + my_free(line_buff); } } @@ -77,7 +77,7 @@ LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, char * str) return 0; if (init_line_buffer_from_string(line_buff,str)) { - my_free(line_buff,MYF(0)); + my_free(line_buff); return 0; } return line_buff; diff --git a/client/sql_string.h b/client/sql_string.h index 1a3ac5d33c5..bafc287c73e 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -175,7 +175,7 @@ public: { alloced=0; Alloced_length=0; - my_free(Ptr,MYF(0)); + my_free(Ptr); Ptr=0; str_length=0; /* Safety */ } -- cgit v1.2.1 From f4f8de20ada9e021d857c8e17e96fa6c5a0693b1 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 8 Jul 2010 23:40:48 +0100 Subject: BUG#54744: valgrind reports leak for mysqlbinlog The server was not cleaning up some dbug allocated memory before exiting. This is not a real problem, as this memory would be deallocated anyway. Nonetheless, we improve the mysqlbinlog exit procedure, wrt to memory book-keeping, when no parameter is given. To fix this, we deploy a call to my_end() before the thread exits. --- client/mysqlbinlog.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'client') diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 9d85e24d03f..971442e6d60 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,6 +2032,7 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); + my_end(my_end_arg); exit(1); } -- cgit v1.2.1 From dbf76b0deb58ef188585b85f93a0add4d8fcc9d8 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 8 Jul 2010 22:19:57 -0300 Subject: Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Post-merge fix: cast argument and correct type in assignment. --- client/mysqltest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client') diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 1d821c18111..9845a3ec060 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6338,7 +6338,7 @@ void free_win_path_patterns() for (i=0 ; i < patterns.elements ; i++) { const char** pattern= dynamic_element(&patterns, i, const char**); - my_free(*pattern); + my_free((void *) *pattern); } delete_dynamic(&patterns); } -- cgit v1.2.1 From f54a1182494db9bababccfa83692630bec51ca95 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:13:30 -0300 Subject: WL#5486: Remove code for unsupported platforms Remove Netware specific code. --- client/client_priv.h | 2 +- client/mysql.cc | 56 ++++++++------------------------------------------ client/mysql_upgrade.c | 7 ------- client/mysqladmin.cc | 12 ----------- client/mysqlbinlog.cc | 12 ----------- client/mysqlcheck.c | 12 ----------- client/mysqldump.c | 14 ------------- client/mysqlimport.c | 12 ----------- client/mysqlshow.c | 13 ------------ client/mysqlslap.c | 8 -------- client/mysqltest.cc | 5 ----- 11 files changed, 9 insertions(+), 144 deletions(-) (limited to 'client') diff --git a/client/client_priv.h b/client/client_priv.h index b0991c0134f..e7911fc31f7 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -60,7 +60,7 @@ enum options_client OPT_IMPORT_USE_THREADS, OPT_MYSQL_NUMBER_OF_QUERY, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, + OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA, OPT_MYSQLDUMP_SLAVE_APPLY, OPT_MYSQLDUMP_SLAVE_DATA, OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, diff --git a/client/mysql.cc b/client/mysql.cc index d64bd8f686a..a31c503b9a2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -91,7 +91,7 @@ extern "C" { #undef bcmp // Fix problem with new readline #if defined(__WIN__) #include -#elif !defined(__NETWARE__) +#else #include #define HAVE_READLINE #endif @@ -109,7 +109,7 @@ extern "C" { #define cmp_database(cs,A,B) strcmp((A),(B)) #endif -#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(THREAD) +#if !defined(__WIN__) && !defined(THREAD) #define USE_POPEN #endif @@ -1365,10 +1365,6 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0}, {"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"auto-rehash", OPT_AUTO_REHASH, "Enable automatic rehashing. One doesn't need to use 'rehash' to get table " "and field completion, but startup and reconnecting may take a longer time. " @@ -1582,11 +1578,6 @@ static struct my_option my_long_options[] = static void usage(int version) { - /* Divert all help information on NetWare to logger screen. */ -#ifdef __NETWARE__ -#define printf consoleprintf -#endif - #if defined(USE_LIBEDIT_INTERFACE) const char* readline= ""; #else @@ -1609,10 +1600,6 @@ static void usage(int version) my_print_help(my_long_options); print_defaults("my", load_default_groups); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); -#ifdef __NETWARE__ -#undef printf -#endif } @@ -1621,11 +1608,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case OPT_CHARSETS_DIR: strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1); charsets_dir = mysql_charsets_dir; @@ -1851,10 +1833,6 @@ static int get_options(int argc, char **argv) static int read_and_execute(bool interactive) { -#if defined(__NETWARE__) - char linebuffer[254]; - String buffer; -#endif #if defined(__WIN__) String tmpbuf; String buffer; @@ -1900,18 +1878,8 @@ static int read_and_execute(bool interactive) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) tee_fputs(prompt, stdout); -#if defined(__NETWARE__) - line=fgets(linebuffer, sizeof(linebuffer)-1, stdin); - /* Remove the '\n' */ - if (line) - { - char *p = strrchr(line, '\n'); - if (p != NULL) - *p = '\0'; - } -#else if (!tmpbuf.is_alloced()) tmpbuf.alloc(65535); tmpbuf.length(0); @@ -1932,12 +1900,11 @@ static int read_and_execute(bool interactive) */ if (line) line= buffer.c_ptr(); -#endif /* __NETWARE__ */ #else if (opt_outfile) fputs(prompt, OUTFILE); line= readline(prompt); -#endif /* defined(__WIN__) || defined(__NETWARE__) */ +#endif /* defined(__WIN__) */ /* When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS @@ -1985,10 +1952,8 @@ static int read_and_execute(bool interactive) } } -#if defined(__WIN__) || defined(__NETWARE__) - buffer.free(); -#endif #if defined(__WIN__) + buffer.free(); tmpbuf.free(); #endif @@ -3945,8 +3910,6 @@ static int com_quit(String *buffer __attribute__((unused)), char *line __attribute__((unused))) { - /* let the screen auto close on a normal shutdown */ - NETWARE_SET_SCREEN_MODE(SCR_AUTOCLOSE_ON_EXIT); status.exit_status=0; return 1; } @@ -4664,7 +4627,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...) { va_list args; - NETWARE_YIELD; va_start(args, fmt); (void) vfprintf(file, fmt, args); va_end(args); @@ -4680,7 +4642,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...) void tee_fputs(const char *s, FILE *file) { - NETWARE_YIELD; fputs(s, file); if (opt_outfile) fputs(s, OUTFILE); @@ -4689,7 +4650,6 @@ void tee_fputs(const char *s, FILE *file) void tee_puts(const char *s, FILE *file) { - NETWARE_YIELD; fputs(s, file); fputc('\n', file); if (opt_outfile) @@ -4706,7 +4666,7 @@ void tee_putc(int c, FILE *file) putc(c, OUTFILE); } -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(__WIN__) #include #else #include @@ -4718,8 +4678,8 @@ void tee_putc(int c, FILE *file) static ulong start_timer(void) { -#if defined(__WIN__) || defined(__NETWARE__) - return clock(); +#if defined(__WIN__) + return clock(); #else struct tms tms_tmp; return times(&tms_tmp); diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0ad44f3d20d..20436200c7e 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -57,8 +57,6 @@ static my_bool not_used; /* Can't use GET_BOOL without a value pointer */ static my_bool opt_write_binlog; -#include - static struct my_option my_long_options[]= { {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, @@ -139,8 +137,6 @@ static struct my_option my_long_options[]= {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include - static void free_used_memory(void) { @@ -809,9 +805,6 @@ int main(int argc, char **argv) char self_name[FN_REFLEN]; MY_INIT(argv[0]); -#ifdef __NETWARE__ - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); -#endif #if __WIN__ if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index bf0dec01d2f..69381b749a1 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -116,10 +116,6 @@ static TYPELIB command_typelib= static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"count", 'c', "Number of iterations to make. This works with -i (--sleep) only.", &nr_iterations, &nr_iterations, 0, GET_UINT, @@ -222,11 +218,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int error = 0; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'c': opt_count_iterations= 1; break; @@ -1068,13 +1059,11 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return 0; } -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s on %s\n",my_progname,ADMIN_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -1118,7 +1107,6 @@ static void usage(void) version Get version info from server"); } -#include static int drop_db(MYSQL *mysql, const char *db) { diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index a7875d63aa2..f491485b77a 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1002,10 +1002,6 @@ static struct my_option my_long_options[] = { {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"base64-output", OPT_BASE64_OUTPUT_MODE, /* 'unspec' is not mentioned because it is just a placeholder. */ "Determine when the output statements should be base64-encoded BINLOG " @@ -1233,12 +1229,10 @@ static void cleanup() mysql_close(mysql); } -#include static void print_version() { printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -1280,7 +1274,6 @@ static my_time_t convert_str_to_timestamp(const char* str) my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap); } -#include extern "C" my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -1288,11 +1281,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { bool tty_password=0; switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif #ifndef DBUG_OFF case '#': DBUG_PUSH(argument ? argument : default_dbug_option); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 2c9c563e17f..025f6c2bd2b 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -62,10 +62,6 @@ static struct my_option my_long_options[] = "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.", &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"auto-repair", OPT_AUTO_REPAIR, "If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.", &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0, @@ -208,13 +204,11 @@ static uint fixed_name_length(const char *name); static char *fix_table_name(char *dest, char *src); int what_to_do = 0; -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, CHECK_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } /* print_version */ @@ -245,18 +239,12 @@ static void usage(void) my_print_variables(my_long_options); } /* usage */ -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': what_to_do = DO_ANALYZE; break; diff --git a/client/mysqldump.c b/client/mysqldump.c index 6d294153c54..e1f4f0e518d 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -212,10 +212,6 @@ static struct my_option my_long_options[] = "Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.", &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -531,7 +527,6 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) static int dump_tablespaces_for_databases(char** databases); static int dump_tablespaces(char* ts_where); -#include /* Print the supplied message if in verbose mode @@ -575,7 +570,6 @@ static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } /* print_version */ @@ -585,7 +579,6 @@ static void short_usage_sub(void) printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n", my_progname); printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname); - NETWARE_SET_SCREEN_MODE(1); } @@ -608,8 +601,6 @@ static void short_usage(void) printf("For more options, use %s --help\n", my_progname); } -#include - static void write_header(FILE *sql_file, char *db_name) { @@ -728,11 +719,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'p': if (argument == disabled_my_option) argument= (char*) ""; /* Don't require password */ diff --git a/client/mysqlimport.c b/client/mysqlimport.c index fdb521b9cf8..3d71e437e40 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -67,10 +67,6 @@ static char *shared_memory_base_name=0; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -184,13 +180,11 @@ static struct my_option my_long_options[] = static const char *load_default_groups[]= { "mysqlimport","client",0 }; -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n" ,my_progname, IMPORT_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -212,18 +206,12 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'p': if (argument == disabled_my_option) argument= (char*) ""; /* Don't require password */ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 76f9048e09e..0b9f42acfe8 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -160,10 +160,6 @@ int main(int argc, char **argv) static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"character-sets-dir", 'c', "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -240,14 +236,11 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; - -#include static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -270,18 +263,12 @@ are shown."); my_print_variables(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'v': opt_verbose++; break; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index e411b096d68..e605e2d522c 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -676,8 +676,6 @@ static struct my_option my_long_options[] = }; -#include - static void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION, @@ -696,7 +694,6 @@ static void usage(void) my_print_help(my_long_options); } -#include static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -704,11 +701,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { DBUG_ENTER("get_one_option"); switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'v': verbose++; break; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9845a3ec060..9e28183c735 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3707,7 +3707,6 @@ void do_send_quit(struct st_command *command) void do_change_user(struct st_command *command) { MYSQL *mysql = &cur_con->mysql; - /* static keyword to make the NetWare compiler happy. */ static DYNAMIC_STRING ds_user, ds_passwd, ds_db; const struct command_arg change_user_args[] = { { "user", ARG_STRING, FALSE, &ds_user, "User to connect as" }, @@ -6006,8 +6005,6 @@ static struct my_option my_long_options[] = }; -#include - void print_version(void) { printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,MTEST_VERSION, @@ -6026,8 +6023,6 @@ void usage() my_print_variables(my_long_options); } -#include - /* Read arguments for embedded server and put them into -- cgit v1.2.1 From b3d22cef93306849f7eaeba2907bcd1099f9e33f Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 15 Jul 2010 08:16:06 -0300 Subject: WL#5486: Remove code for unsupported platforms Remove MS-DOS specific code. --- client/mysqldump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'client') diff --git a/client/mysqldump.c b/client/mysqldump.c index e1f4f0e518d..68cfde864b5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -429,10 +429,10 @@ static struct my_option my_long_options[] = &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"result-file", 'r', - "Direct output to a given file. This option should be used in MSDOS, " - "because it prevents new line '\\n' from being converted to '\\r\\n' " - "(carriage return + line feed).", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Direct output to a given file. This option should be used in systems " + "(e.g., DOS, Windows) that use carriage-return linefeed pairs (\\r\\n) " + "to separate text lines. This option ensures that only a single newline " + "is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"routines", 'R', "Dump stored routines (functions and procedures).", &opt_routines, &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -- cgit v1.2.1