diff options
author | Staale Smedseng <staale.smedseng@sun.com> | 2009-08-28 18:21:54 +0200 |
---|---|---|
committer | Staale Smedseng <staale.smedseng@sun.com> | 2009-08-28 18:21:54 +0200 |
commit | 5be4c3822691f8bca4c8444ccc77b4b01bc996c1 (patch) | |
tree | a1ec5dfbd668a88bc0b6c98db397a421d2b37f21 | |
parent | 169f7da04c4ffc43355d5a632a8013bc4caea39b (diff) | |
parent | 1ba25ae47caace207cda0be2b7994a1a845e6cce (diff) | |
download | mariadb-git-5be4c3822691f8bca4c8444ccc77b4b01bc996c1.tar.gz |
Merge from 5.0 for 43414
45 files changed, 119 insertions, 156 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 1491ff1b059..bafd173343e 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3819,7 +3819,8 @@ com_edit(String *buffer,char *line __attribute__((unused))) !(editor = (char *)getenv("VISUAL"))) editor = "vi"; strxmov(buff,editor," ",filename,NullS); - (void) system(buff); + if(system(buff) == -1) + goto err; MY_STAT stat_arg; if (!my_stat(filename,&stat_arg,MYF(MY_WME))) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 645fb037647..cfd7ed4ea56 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -552,6 +552,7 @@ static int upgrade_already_done(void) FILE *in; char upgrade_info_file[FN_REFLEN]= {0}; char buf[sizeof(MYSQL_SERVER_VERSION)+1]; + char *res; if (get_upgrade_info_file_name(upgrade_info_file)) return 0; /* Could not get filename => not sure */ @@ -564,7 +565,7 @@ static int upgrade_already_done(void) will be detected by the strncmp */ bzero(buf, sizeof(buf)); - fgets(buf, sizeof(buf), in); + res= fgets(buf, sizeof(buf), in); my_fclose(in, MYF(0)); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index a4e7c5ad0c9..299be5a842f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1036,14 +1036,16 @@ static void usage(void) static int drop_db(MYSQL *mysql, const char *db) { char name_buff[FN_REFLEN+20], buf[10]; + char *input; + if (!option_force) { puts("Dropping the database is potentially a very bad thing to do."); puts("Any data stored in the database will be destroyed.\n"); printf("Do you really want to drop the '%s' database [y/N] ",db); fflush(stdout); - VOID(fgets(buf,sizeof(buf)-1,stdin)); - if ((*buf != 'y') && (*buf != 'Y')) + input= fgets(buf, sizeof(buf)-1, stdin); + if (!input || ((*input != 'y') && (*input != 'Y'))) { puts("\nOK, aborting database drop!"); return -1; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 265d3b0a8e7..b9535ba6b05 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -431,10 +431,12 @@ DYNAMIC_STRING ds_res; char builtin_echo[FN_REFLEN]; +static void cleanup_and_exit(int exit_code) __attribute__((noreturn)); + void die(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); + ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn)); void abort_not_supported_test(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); + ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn)); void verbose_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); void log_msg(const char *fmt, ...) @@ -3705,10 +3707,9 @@ void do_wait_for_slave_to_stop(struct st_command *c __attribute__((unused))) MYSQL* mysql = &cur_con->mysql; for (;;) { - MYSQL_RES *res; + MYSQL_RES *UNINIT_VAR(res); MYSQL_ROW row; int done; - LINT_INIT(res); if (mysql_query(mysql,"show status like 'Slave_running'") || !(res=mysql_store_result(mysql))) @@ -5240,13 +5241,12 @@ my_bool end_of_query(int c) int read_line(char *buf, int size) { - char c, last_quote; + char c, UNINIT_VAR(last_quote); char *p= buf, *buf_end= buf + size - 1; int skip_char= 0; enum {R_NORMAL, R_Q, R_SLASH_IN_Q, R_COMMENT, R_LINE_START} state= R_LINE_START; DBUG_ENTER("read_line"); - LINT_INIT(last_quote); start_lineno= cur_file->lineno; DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno)); @@ -6478,8 +6478,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (!disable_result_log) { - ulonglong affected_rows; /* Ok to be undef if 'disable_info' is set */ - LINT_INIT(affected_rows); + ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */ if (res) { diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c index 490691943a8..c669322f436 100644 --- a/cmd-line-utils/readline/bind.c +++ b/cmd-line-utils/readline/bind.c @@ -339,9 +339,7 @@ rl_generic_bind (type, keyseq, data, map) char *keys; int keys_len; register int i; - KEYMAP_ENTRY k; - - k.function = 0; + KEYMAP_ENTRY k= { 0, NULL }; /* If no keys to bind to, exit right away. */ if (keyseq == 0 || *keyseq == 0) @@ -776,7 +774,7 @@ _rl_read_file (filename, sizep) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { if (file >= 0) diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c index 118c5ebd328..cbd367542ce 100644 --- a/cmd-line-utils/readline/histfile.c +++ b/cmd-line-utils/readline/histfile.c @@ -186,7 +186,7 @@ read_history_range (filename, from, to) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { errno = overflow_errno; @@ -311,6 +311,7 @@ history_truncate_file (fname, lines) int file, chars_read, rv; struct stat finfo; size_t file_size; + size_t bytes_written; buffer = (char *)NULL; filename = history_filename (fname); @@ -340,7 +341,7 @@ history_truncate_file (fname, lines) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ -if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || file_size + 1 < file_size) { close (file); @@ -400,7 +401,7 @@ if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || truncate to. */ if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { - write (file, bp, chars_read - (bp - buffer)); + bytes_written= write (file, bp, chars_read - (bp - buffer)); #if defined (__BEOS__) /* BeOS ignores O_TRUNC. */ diff --git a/cmd-line-utils/readline/undo.c b/cmd-line-utils/readline/undo.c index 79846c26024..c6bd044c3a3 100644 --- a/cmd-line-utils/readline/undo.c +++ b/cmd-line-utils/readline/undo.c @@ -137,7 +137,8 @@ UNDO_LIST * _rl_copy_undo_list (head) UNDO_LIST *head; { - UNDO_LIST *list, *new, *roving, *c; + UNDO_LIST *list, *new, *c; + UNDO_LIST *roving= NULL; list = head; new = 0; diff --git a/include/my_global.h b/include/my_global.h index 4ad851e9e5d..e7d0026ac53 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -564,6 +564,25 @@ int __void__; #define PURIFY_OR_LINT_INIT(var) #endif +/* + Suppress uninitialized variable warning without generating code. + + The _cplusplus is a temporary workaround for C++ code pending a fix + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). +*/ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ + !defined(__GNUC__) +#define UNINIT_VAR(x) x= 0 +#else +#define UNINIT_VAR(x) x= x +#endif + +/* Define some useful general macros */ +#if !defined(max) +#define max(a, b) ((a) > (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + #if !defined(HAVE_UINT) #undef HAVE_UINT #define HAVE_UINT diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 50995601d1f..1264f2765ba 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1635,8 +1635,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name) char *to; #ifdef USE_MB my_bool use_mb_flag=use_mb(mysql->charset); - char *end; - LINT_INIT(end); + char *UNINIT_VAR(end); if (use_mb_flag) for (end=name; *end ; end++) ; #endif diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index d4828946d82..9775a842b18 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -33,12 +33,11 @@ static char * NEAR_F expand_tilde(char * *path); void pack_dirname(char * to, const char *from) { int cwd_err; - size_t d_length,length,buff_length; + size_t d_length,length,UNINIT_VAR(buff_length); char * start; char buff[FN_REFLEN]; DBUG_ENTER("pack_dirname"); - LINT_INIT(buff_length); (void) intern_filename(to,from); /* Change to intern name */ #ifdef FN_DEVCHAR diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 5679d13d39d..64f1623aa59 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -56,6 +56,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) File from_file,to_file; uchar buff[IO_SIZE]; MY_STAT stat_buff,new_stat_buff; + int res; DBUG_ENTER("my_copy"); DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); @@ -94,9 +95,9 @@ int my_copy(const char *from, const char *to, myf MyFlags) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) DBUG_RETURN(0); /* File copyed but not stat */ - VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */ + res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */ #if !defined(__WIN__) && !defined(__NETWARE__) - VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */ + res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ #endif #if !defined(VMS) && !defined(__ZTC__) if (MyFlags & MY_COPYTIME) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index fd3c2501226..b6eb6dac54f 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -116,7 +116,7 @@ int handle_options(int *argc, char ***argv, uint opt_found, argvpos= 0, length; my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; - char **pos, **pos_end, *optend, *prev_found, + char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found), *opt_str, key_name[FN_REFLEN]; const struct my_option *optp; uchar* *value; diff --git a/mysys/my_redel.c b/mysys/my_redel.c index b12cf098283..c03d1bc7c25 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -76,6 +76,7 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; + int res; if (stat((char*) from, &statbuf)) { @@ -94,7 +95,7 @@ int my_copystat(const char *from, const char *to, int MyFlags) if (MyFlags & MY_LINK_WARNING) my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); } - VOID(chown(to, statbuf.st_uid, statbuf.st_gid)); /* Copy ownership */ + res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ #endif /* !__WIN__ && !__NETWARE__ */ #ifndef VMS diff --git a/mysys/typelib.c b/mysys/typelib.c index e745a9fb917..92ffe9316ff 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -70,7 +70,8 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option) int find_type(char *x, const TYPELIB *typelib, uint full_name) { - int find,pos,findpos; + int find,pos; + int UNINIT_VAR(findpos); /* guarded by find */ reg1 char * i; reg2 const char *j; DBUG_ENTER("find_type"); @@ -81,7 +82,6 @@ int find_type(char *x, const TYPELIB *typelib, uint full_name) DBUG_PRINT("exit",("no count")); DBUG_RETURN(0); } - LINT_INIT(findpos); find=0; for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) { diff --git a/regex/regcomp.c b/regex/regcomp.c index 398e132d97d..b203d4941e1 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -213,11 +213,11 @@ register struct parse *p; int stop; /* character this ERE should end at */ { register char c; - register sopno prevback; - register sopno prevfwd; + register sopno UNINIT_VAR(prevback); + register sopno UNINIT_VAR(prevfwd); register sopno conc; register int first = 1; /* is this the first alternative? */ - LINT_INIT(prevback); LINT_INIT(prevfwd); + for (;;) { /* do a bunch of concatenated expressions */ conc = HERE(); diff --git a/sql-common/client.c b/sql-common/client.c index 5a9ea84b498..05071865928 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1849,7 +1849,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, uint port, const char *unix_socket,ulong client_flag) { char buff[NAME_LEN+USERNAME_LENGTH+100]; - char *end,*host_info; + char *end,*host_info= NULL; my_socket sock; in_addr_t ip_addr; struct sockaddr_in sock_addr; @@ -1867,7 +1867,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, #endif init_sigpipe_variables DBUG_ENTER("mysql_real_connect"); - LINT_INIT(host_info); DBUG_PRINT("enter",("host: %s db: %s user: %s", host ? host : "(Null)", diff --git a/sql-common/my_time.c b/sql-common/my_time.c index a1b85049934..18358519023 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -160,7 +160,7 @@ enum enum_mysql_timestamp_type str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, uint flags, int *was_cut) { - uint field_length, year_length, digits, i, number_of_fields; + uint field_length, UNINIT_VAR(year_length), digits, i, number_of_fields; uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS]; uint add_hours= 0, start_loop; ulong not_zero_date, allow_space; @@ -174,7 +174,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, DBUG_PRINT("ENTER",("str: %.*s",length,str)); LINT_INIT(field_length); - LINT_INIT(year_length); LINT_INIT(last_field_pos); *was_cut= 0; diff --git a/sql/field.cc b/sql/field.cc index 426effa57cd..9f46552d5bd 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1922,16 +1922,16 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs) Pointers used when digits move from the left of the '.' to the right of the '.' (explained below) */ - const uchar *int_digits_tail_from; + const uchar *UNINIT_VAR(int_digits_tail_from); /* Number of 0 that need to be added at the left of the '.' (1E3: 3 zeros) */ - uint int_digits_added_zeros; + uint UNINIT_VAR(int_digits_added_zeros); /* Pointer used when digits move from the right of the '.' to the left of the '.' */ - const uchar *frac_digits_head_end; + const uchar *UNINIT_VAR(frac_digits_head_end); /* Number of 0 that need to be added at the right of the '.' (for 1E-3) */ - uint frac_digits_added_zeros; + uint UNINIT_VAR(frac_digits_added_zeros); uchar *pos,*tmp_left_pos,*tmp_right_pos; /* Pointers that are used as limits (begin and end of the field buffer) */ uchar *left_wall,*right_wall; @@ -1942,11 +1942,6 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs) */ bool is_cuted_fields_incr=0; - LINT_INIT(int_digits_tail_from); - LINT_INIT(int_digits_added_zeros); - LINT_INIT(frac_digits_head_end); - LINT_INIT(frac_digits_added_zeros); - /* There are three steps in this function : - parse the input string @@ -10002,10 +9997,8 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length, TYPELIB *interval, const char *field_name) { - uchar *bit_ptr; - uchar bit_offset; - LINT_INIT(bit_ptr); - LINT_INIT(bit_offset); + uchar *UNINIT_VAR(bit_ptr); + uchar UNINIT_VAR(bit_offset); if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag)) { bit_ptr= null_pos; diff --git a/sql/item.cc b/sql/item.cc index c1ba6fe77a3..26df3a45971 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1673,7 +1673,7 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname, bool agg_item_set_converter(DTCollation &coll, const char *fname, Item **args, uint nargs, uint flags, int item_sep) { - Item **arg, *safe_args[2]; + Item **arg, *safe_args[2]= {NULL, NULL}; /* For better error reporting: save the first and the second argument. @@ -1682,8 +1682,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, doesn't display each argument's characteristics. - if nargs is 1, then this error cannot happen. */ - LINT_INIT(safe_args[0]); - LINT_INIT(safe_args[1]); if (nargs >=2 && nargs <= 3) { safe_args[0]= args[0]; @@ -5507,9 +5505,8 @@ bool Item_null::send(Protocol *protocol, String *packet) bool Item::send(Protocol *protocol, String *buffer) { - bool result; + bool UNINIT_VAR(result); // Will be set if null_value == 0 enum_field_types f_type; - LINT_INIT(result); // Will be set if null_value == 0 switch ((f_type=field_type())) { default: diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 53feb753844..d229453b795 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -395,11 +395,10 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, ulong orig_sql_mode= thd->variables.sql_mode; enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields; my_bitmap_map *old_maps[2]; - ulonglong orig_field_val; /* original field value if valid */ + ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */ LINT_INIT(old_maps[0]); LINT_INIT(old_maps[1]); - LINT_INIT(orig_field_val); if (table) dbug_tmp_use_all_columns(table, old_maps, diff --git a/sql/item_create.cc b/sql/item_create.cc index bf359b10caa..7991d9adf82 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -5032,10 +5032,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, const char *c_len, const char *c_dec, CHARSET_INFO *cs) { - Item *res; + Item *UNINIT_VAR(res); ulong len; uint dec; - LINT_INIT(res); switch (cast_type) { case ITEM_CAST_BINARY: diff --git a/sql/item_func.cc b/sql/item_func.cc index 6abc78371db..c775848cff2 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2268,9 +2268,8 @@ void Item_func_min_max::fix_length_and_dec() uint Item_func_min_max::cmp_datetimes(ulonglong *value) { - longlong min_max; + longlong UNINIT_VAR(min_max); uint min_max_idx= 0; - LINT_INIT(min_max); for (uint i=0; i < arg_count ; i++) { @@ -2335,8 +2334,7 @@ String *Item_func_min_max::val_str(String *str) } case STRING_RESULT: { - String *res; - LINT_INIT(res); + String *UNINIT_VAR(res); for (uint i=0; i < arg_count ; i++) { if (i == 0) @@ -2425,8 +2423,7 @@ longlong Item_func_min_max::val_int() my_decimal *Item_func_min_max::val_decimal(my_decimal *dec) { DBUG_ASSERT(fixed == 1); - my_decimal tmp_buf, *tmp, *res; - LINT_INIT(res); + my_decimal tmp_buf, *tmp, *UNINIT_VAR(res); if (compare_as_dates) { @@ -5420,8 +5417,7 @@ void Item_func_match::init_search(bool no_order) bool Item_func_match::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); - Item *item; - LINT_INIT(item); // Safe as arg_count is > 1 + Item *UNINIT_VAR(item); // Safe as arg_count is > 1 maybe_null=1; join_key=0; diff --git a/sql/lock.cc b/sql/lock.cc index 322778b89c3..93d8b868688 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1472,11 +1472,10 @@ void unlock_global_read_lock(THD *thd) bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commit) { - const char *old_message; + const char *UNINIT_VAR(old_message); bool result= 0, need_exit_cond; DBUG_ENTER("wait_if_global_read_lock"); - LINT_INIT(old_message); /* Assert that we do not own LOCK_open. If we would own it, other threads could not close their tables. This would make a pretty diff --git a/sql/log.cc b/sql/log.cc index 282312d28e2..1af2f3a4ddc 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4831,7 +4831,8 @@ bool flush_error_log() my_rename(log_error_file,err_renamed,MYF(0)); if (freopen(log_error_file,"a+",stdout)) { - freopen(log_error_file,"a+",stderr); + FILE *reopen; + reopen= freopen(log_error_file,"a+",stderr); setbuf(stderr, NULL); } else diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3e18d20c903..a451674e5be 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -4838,11 +4838,10 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, { int idx; SEL_ARG **key,**end, **key_to_read= NULL; - ha_rows best_records; + ha_rows UNINIT_VAR(best_records); /* protected by key_to_read */ TRP_RANGE* read_plan= NULL; bool pk_is_clustered= param->table->file->primary_key_is_clustered(); DBUG_ENTER("get_key_scans_params"); - LINT_INIT(best_records); /* protected by key_to_read */ /* Note that there may be trees that have type SEL_TREE::KEY but contain no key reads at all, e.g. tree for expression "key1 is not null" where key1 @@ -6798,9 +6797,7 @@ static bool eq_tree(SEL_ARG* a,SEL_ARG *b) SEL_ARG * SEL_ARG::insert(SEL_ARG *key) { - SEL_ARG *element,**par,*last_element; - LINT_INIT(par); - LINT_INIT(last_element); + SEL_ARG *element,**UNINIT_VAR(par),*UNINIT_VAR(last_element); for (element= this; element != &null_element ; ) { @@ -9405,7 +9402,9 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) goto next_index; } else + { DBUG_ASSERT(FALSE); + } /* Check (SA2). */ if (min_max_arg_item) diff --git a/sql/spatial.cc b/sql/spatial.cc index 97e5fcfa27a..9114c81514d 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -937,13 +937,10 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const int Gis_polygon::centroid_xy(double *x, double *y) const { uint32 n_linear_rings; - double res_area; - double res_cx, res_cy; + double UNINIT_VAR(res_area); + double UNINIT_VAR(res_cx), UNINIT_VAR(res_cy); const char *data= m_data; bool first_loop= 1; - LINT_INIT(res_area); - LINT_INIT(res_cx); - LINT_INIT(res_cy); if (no_data(data, 4)) return 1; @@ -1638,14 +1635,10 @@ int Gis_multi_polygon::centroid(String *result) const uint32 n_polygons; bool first_loop= 1; Gis_polygon p; - double res_area, res_cx, res_cy; + double UNINIT_VAR(res_area), UNINIT_VAR(res_cx), UNINIT_VAR(res_cy); double cur_area, cur_cx, cur_cy; const char *data= m_data; - LINT_INIT(res_area); - LINT_INIT(res_cx); - LINT_INIT(res_cy); - if (no_data(data, 4)) return 1; n_polygons= uint4korr(data); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fb5d58b63c4..ca27d476213 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -457,7 +457,7 @@ pthread_handler_t handle_bootstrap(void *arg) thd->init_for_queries(); while (fgets(buff, thd->net.max_packet, file)) { - char *query; + char *query, *res; /* strlen() can't be deleted because fgets() doesn't return length */ ulong length= (ulong) strlen(buff); while (buff[length-1] != '\n' && !feof(file)) @@ -474,7 +474,7 @@ pthread_handler_t handle_bootstrap(void *arg) break; } buff= (char*) thd->net.buff; - fgets(buff + length, thd->net.max_packet - length, file); + res= fgets(buff + length, thd->net.max_packet - length, file); length+= (ulong) strlen(buff + length); /* purecov: end */ } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 2a4c5c950fe..43d0b9fade0 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1032,7 +1032,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, TABLE_LIST *top_view= table->top_table(); bool parse_status; bool result, view_is_mergeable; - TABLE_LIST *view_main_select_tables; + TABLE_LIST *UNINIT_VAR(view_main_select_tables); DBUG_ENTER("mysql_make_view"); DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name)); @@ -1310,7 +1310,6 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, old_lex->set_stmt_unsafe(); view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE && lex->can_be_merged()); - LINT_INIT(view_main_select_tables); if (view_is_mergeable) { diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index e57a554e5d9..5c548b6be74 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -62,11 +62,10 @@ int main(int argc, char *argv[]) HP_SHARE *tmp_share; HP_KEYDEF keyinfo[MAX_KEYS]; HA_KEYSEG keyseg[MAX_KEYS*5]; - HEAP_PTR position; + HEAP_PTR UNINIT_VAR(position); HP_CREATE_INFO hp_create_info; CHARSET_INFO *cs= &my_charset_latin1; MY_INIT(argv[0]); /* init my_sys library & pthreads */ - LINT_INIT(position); filename= "test2"; filename2= "test2_2"; diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 58363894cff..0a2847be514 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -358,10 +358,9 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) int subkeys=1; my_bool can_go_down; MI_INFO *info=ftb->info; - uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength; + uint UNINIT_VAR(off), extra=HA_FT_WLEN+info->s->base.rec_reflength; uchar *lastkey_buf=ftbw->word+ftbw->off; - LINT_INIT(off); if (ftbw->flags & FTB_FLAG_TRUNC) lastkey_buf+=ftbw->len; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 1cb0613331d..15eb28e6183 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -140,11 +140,10 @@ int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag) { reg2 ha_rows i; uint delete_link_length; - my_off_t empty,next_link,old_link; + my_off_t empty,next_link,UNINIT_VAR(old_link); char buff[22],buff2[22]; DBUG_ENTER("chk_del"); - LINT_INIT(old_link); param->record_checksum=0; delete_link_length=((info->s->options & HA_OPTION_PACK_RECORD) ? 20 : info->s->rec_reflength+1); @@ -937,11 +936,11 @@ static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo) int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) { int error,got_error,flag; - uint key,left_length,b_type,field; + uint key,UNINIT_VAR(left_length),b_type,field; ha_rows records,del_blocks; - my_off_t used,empty,pos,splits,start_recpos, + my_off_t used,empty,pos,splits,UNINIT_VAR(start_recpos), del_length,link_used,start_block; - uchar *record= 0, *to; + uchar *record= 0, *UNINIT_VAR(to); char llbuff[22],llbuff2[22],llbuff3[22]; ha_checksum intern_record_checksum; ha_checksum key_checksum[HA_MAX_POSSIBLE_KEY]; @@ -966,7 +965,6 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) records=del_blocks=0; used=link_used=splits=del_length=0; intern_record_checksum=param->glob_crc=0; - LINT_INIT(left_length); LINT_INIT(start_recpos); LINT_INIT(to); got_error=error=0; empty=info->s->pack.header_length; @@ -2226,9 +2224,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ulong *rec_per_key_part; char llbuff[22]; SORT_INFO sort_info; - ulonglong key_map; + ulonglong UNINIT_VAR(key_map); DBUG_ENTER("mi_repair_by_sort"); - LINT_INIT(key_map); start_records=info->state->records; got_error=1; @@ -2650,11 +2647,10 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, IO_CACHE new_data_cache; /* For non-quick repair. */ IO_CACHE_SHARE io_share; SORT_INFO sort_info; - ulonglong key_map; + ulonglong UNINIT_VAR(key_map); pthread_attr_t thr_attr; ulong max_pack_reclength; DBUG_ENTER("mi_repair_parallel"); - LINT_INIT(key_map); start_records=info->state->records; got_error=1; @@ -3241,7 +3237,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) int parallel_flag; uint found_record,b_type,left_length; my_off_t pos; - uchar *to; + uchar *UNINIT_VAR(to); MI_BLOCK_INFO block_info; SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 448e1b3c6f8..0b4d781379c 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -38,7 +38,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, MI_CREATE_INFO *ci,uint flags) { register uint i,j; - File dfile,file; + File UNINIT_VAR(dfile),file; int errpos,save_errno, create_mode= O_RDWR | O_TRUNC; myf create_flag; uint fields,length,max_key_length,packed,pointer,real_length_diff, diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c index aa09216ce89..904ce4b2247 100644 --- a/storage/myisam/mi_delete.c +++ b/storage/myisam/mi_delete.c @@ -220,7 +220,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, uint length,nod_flag,search_key_length; my_bool last_key; uchar *leaf_buff,*keypos; - my_off_t leaf_page,next_block; + my_off_t UNINIT_VAR(leaf_page),next_block; uchar lastkey[MI_MAX_KEY_BUFF]; DBUG_ENTER("d_search"); DBUG_DUMP("page",(uchar*) anc_buff,mi_getint(anc_buff)); diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index d1cbd6955dd..696b9ff93df 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -1419,16 +1419,14 @@ void _my_store_blob_length(uchar *pos,uint pack_length,uint length) int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *buf) { int block_of_record; - uint b_type,left_length; - uchar *to; + uint b_type,UNINIT_VAR(left_length); + uchar *UNINIT_VAR(to); MI_BLOCK_INFO block_info; File file; DBUG_ENTER("mi_read_dynamic_record"); if (filepos != HA_OFFSET_ERROR) { - LINT_INIT(to); - LINT_INIT(left_length); file=info->dfile; block_of_record= 0; /* First block of record is numbered as zero. */ block_info.second_read= 0; @@ -1697,13 +1695,12 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, uchar *buf, { int block_of_record, info_read, save_errno; uint left_len,b_type; - uchar *to; + uchar *UNINIT_VAR(to); MI_BLOCK_INFO block_info; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_read_rnd_dynamic_record"); info_read=0; - LINT_INIT(to); if (info->lock_type == F_UNLCK) { diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 328cde20923..e18146f2357 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -700,7 +700,7 @@ err: uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf) { uint extra; - uint32 old_length; + uint32 UNINIT_VAR(old_length); LINT_INIT(old_length); if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf))) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index d9abcbce050..5ef9aa7f88f 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -1363,7 +1363,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff, File file, my_off_t filepos) { uchar *header=info->header; - uint head_length,ref_length; + uint head_length, UNINIT_VAR(ref_length); LINT_INIT(ref_length); if (file >= 0) diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 766e54bde30..b6233d4a092 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -246,12 +246,11 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, uchar *key, uint key_len, uint comp_flag, uchar **ret_pos, uchar *buff, my_bool *last_key) { - int flag; - uint nod_flag,length,not_used[2]; + int UNINIT_VAR(flag); + uint nod_flag,UNINIT_VAR(length),not_used[2]; uchar t_buff[MI_MAX_KEY_BUFF],*end; DBUG_ENTER("_mi_seq_search"); - LINT_INIT(flag); LINT_INIT(length); end= page+mi_getint(page); nod_flag=mi_test_if_nod(page); page+=2+nod_flag; diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c index 2ac405dd785..a18bb5f1443 100644 --- a/storage/myisam/mi_update.c +++ b/storage/myisam/mi_update.c @@ -27,11 +27,8 @@ int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec) my_bool auto_key_changed=0; ulonglong changed; MYISAM_SHARE *share=info->s; - ha_checksum old_checksum; + ha_checksum UNINIT_VAR(old_checksum); DBUG_ENTER("mi_update"); - LINT_INIT(new_key); - LINT_INIT(changed); - LINT_INIT(old_checksum); DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_usage", mi_print_error(info->s, HA_ERR_CRASHED); diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index d505d2633ce..f31edbe1249 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -489,7 +489,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) { SORT_INFO *sort_info=sort_param->sort_info; MI_CHECK *param=sort_info->param; - ulong length, keys; + ulong UNINIT_VAR(length), keys; ulong *rec_per_key_part=param->rec_per_key_part; int got_error=sort_info->got_error; uint i; @@ -896,7 +896,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, int error; uint sort_length,maxcount; ha_rows count; - my_off_t to_start_filepos; + my_off_t UNINIT_VAR(to_start_filepos); uchar *strpos; BUFFPEK *buffpek,**refpek; QUEUE queue; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 44469a03ce0..e265dac2c82 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -145,7 +145,7 @@ static void split_file_name(const char *file_name, extern "C" void myrg_print_wrong_table(const char *table_name) { - LEX_STRING db, name; + LEX_STRING db= {NULL, 0}, name; char buf[FN_REFLEN]; split_file_name(table_name, &db, &name); memcpy(buf, db.str, db.length); diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index 01420f47a0c..b82e3682ebf 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -37,7 +37,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { int save_errno,errpos=0; - uint files= 0, i, dir_length, length, key_parts, min_keys= 0; + uint files= 0, i, dir_length, length, UNINIT_VAR(key_parts), min_keys= 0; ulonglong file_offset=0; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO *m_info=0; @@ -49,8 +49,6 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) my_bool bad_children= FALSE; DBUG_ENTER("myrg_open"); - LINT_INIT(key_parts); - bzero((char*) &file,sizeof(file)); if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT, MY_UNPACK_FILENAME|MY_APPEND_EXT), diff --git a/storage/myisammrg/myrg_rkey.c b/storage/myisammrg/myrg_rkey.c index 8e7886f5a43..c00ca79056f 100644 --- a/storage/myisammrg/myrg_rkey.c +++ b/storage/myisammrg/myrg_rkey.c @@ -38,16 +38,13 @@ int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag) { - uchar *key_buff; - uint pack_key_length; - uint16 last_used_keyseg; + uchar *UNINIT_VAR(key_buff); + uint UNINIT_VAR(pack_key_length); + uint16 UNINIT_VAR(last_used_keyseg); MYRG_TABLE *table; MI_INFO *mi; int err; DBUG_ENTER("myrg_rkey"); - LINT_INIT(key_buff); - LINT_INIT(pack_key_length); - LINT_INIT(last_used_keyseg); if (_myrg_init_queue(info,inx,search_flag)) DBUG_RETURN(my_errno); diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 421bcd2f3cc..a1c691a462b 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -203,11 +203,10 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); while ( s < se && t < te ) { @@ -318,12 +317,10 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t, size_t len) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const char *se=s+len; const char *te=t+len; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); - LINT_INIT(t_wc); while ( s < se && t < te ) { @@ -1387,11 +1384,9 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; - LINT_INIT(s_wc); - LINT_INIT(t_wc); while ( s < se && t < te ) { diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 2afb1930f3d..ae942b59caa 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2310,12 +2310,10 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, my_bool t_is_prefix) { int s_res,t_res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc), t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); - LINT_INIT(t_wc); while ( s < se && t < te ) { @@ -2382,11 +2380,9 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs, my_bool diff_if_only_endspace_difference) { int s_res, t_res, res; - my_wc_t s_wc,t_wc; + my_wc_t UNINIT_VAR(s_wc),t_wc; const uchar *se= s+slen, *te= t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - LINT_INIT(s_wc); - LINT_INIT(t_wc); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE diff_if_only_endspace_difference= 0; diff --git a/strings/decimal.c b/strings/decimal.c index 616d5291482..282e7cae8ab 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1365,8 +1365,7 @@ int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale) if (intg0x) { int i=dig2bytes[intg0x]; - dec1 x; - LINT_INIT(x); + dec1 UNINIT_VAR(x); switch (i) { case 1: x=mi_sint1korr(from); break; @@ -1407,8 +1406,7 @@ int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale) if (frac0x) { int i=dig2bytes[frac0x]; - dec1 x; - LINT_INIT(x); + dec1 UNINIT_VAR(x); switch (i) { case 1: x=mi_sint1korr(from); break; @@ -1486,7 +1484,7 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, decimal_round_mode mode) { int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1, - frac1=ROUND_UP(from->frac), round_digit, + frac1=ROUND_UP(from->frac), UNINIT_VAR(round_digit), intg0=ROUND_UP(from->intg), error=E_DEC_OK, len=to->len, intg1=ROUND_UP(from->intg + (((intg0 + frac0)>0) && (from->buf[0] == DIG_MAX))); @@ -1495,7 +1493,6 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, sanity(to); - LINT_INIT(round_digit); switch (mode) { case HALF_UP: case HALF_EVEN: round_digit=5; break; @@ -2123,13 +2120,11 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, { int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1, frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2, - error, i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); + UNINIT_VAR(error), i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1, *start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry; dec2 norm_factor, x, guess, y; - LINT_INIT(error); - if (mod) to=mod; |