1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

MDEV-6650 - LINT_INIT emits code in non-debug builds

Replaced all references to LINT_INIT with UNINIT_VAR and LINT_INIT_STRUCT.
Removed LINT_INIT macro.
This commit is contained in:
Sergey Vojtovich
2015-02-10 14:05:49 +04:00
parent 10554ca6cb
commit 18e9c314e4
59 changed files with 87 additions and 214 deletions

View File

@@ -157,8 +157,8 @@ fi
# Set flags for various build configurations.
# Used in -valgrind builds
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
# UNINIT_VAR(), which is only useful for silencing spurious warnings
# of static analysis tools. We want UNINIT_VAR() to be a no-op in Valgrind.
valgrind_flags="-DHAVE_valgrind -USAFEMALLOC"
valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized"
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"

View File

@@ -3040,9 +3040,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
init_pager();
char last_char= 0;
int num_name= 0, num_cat= 0;
LINT_INIT(num_name);
LINT_INIT(num_cat);
int UNINIT_VAR(num_name), UNINIT_VAR(num_cat);
if (num_fields == 2)
{
@@ -3179,7 +3177,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
}
/* Remove garbage for nicer messages */
LINT_INIT(buff[0]);
LINT_INIT_STRUCT(buff[0]);
remove_cntrl(*buffer);
if (buffer->is_empty())
@@ -4698,8 +4696,7 @@ com_status(String *buffer __attribute__((unused)),
const char *status_str;
char buff[40];
ulonglong id;
MYSQL_RES *result;
LINT_INIT(result);
MYSQL_RES *UNINIT_VAR(result);
if (mysql_real_query_for_lazy(
C_STRING_WITH_LEN("select DATABASE(), USER() limit 1")))
@@ -5258,8 +5255,7 @@ static void init_username()
my_free(full_username);
my_free(part_username);
MYSQL_RES *result;
LINT_INIT(result);
MYSQL_RES *UNINIT_VAR(result);
if (!mysql_query(&mysql,"select USER()") &&
(result=mysql_use_result(&mysql)))
{

View File

@@ -2617,12 +2617,11 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
{
char *end = (char*)((query_end && *query_end) ?
*query_end : query + strlen(query));
MYSQL_RES *res;
MYSQL_RES *UNINIT_VAR(res);
MYSQL_ROW row;
MYSQL* mysql = cur_con->mysql;
DYNAMIC_STRING ds_query;
DBUG_ENTER("var_query_set");
LINT_INIT(res);
if (!mysql)
{
@@ -2801,7 +2800,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
{
long row_no;
int col_no= -1;
MYSQL_RES* res;
MYSQL_RES* UNINIT_VAR(res);
MYSQL* mysql= cur_con->mysql;
static DYNAMIC_STRING ds_query;
@@ -2814,7 +2813,6 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
};
DBUG_ENTER("var_set_query_get_value");
LINT_INIT(res);
if (!mysql)
{

View File

@@ -57,8 +57,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
char *batch_readline(LINE_BUFFER *line_buff, bool binary_mode)
{
char *pos;
ulong out_length;
LINT_INIT(out_length);
ulong UNINIT_VAR(out_length);
if (!(pos=intern_read_line(line_buff, &out_length)))
return 0;

View File

@@ -457,19 +457,6 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#define STDERR_FILENO 2
#endif
/*
Deprecated workaround for false-positive uninitialized variables
warnings. Those should be silenced using tool-specific heuristics.
Enabled by default for g++ due to the bug referenced below.
*/
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
(defined(__GNUC__) && defined(__cplusplus))
#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
#ifndef SO_EXT
#ifdef _WIN32
#define SO_EXT ".dll"

View File

@@ -859,12 +859,11 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
MYSQL_RES * STDCALL
mysql_list_processes(MYSQL *mysql)
{
MYSQL_DATA *fields;
MYSQL_DATA *UNINIT_VAR(fields);
uint field_count;
uchar *pos;
DBUG_ENTER("mysql_list_processes");
LINT_INIT(fields);
if (simple_command(mysql,COM_PROCESS_INFO,0,0,0))
DBUG_RETURN(0);
free_old_query(mysql);

View File

@@ -315,12 +315,11 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack)
{
uchar** fp;
uchar** UNINIT_VAR(fp);
uint frame_count = 0, sigreturn_frame_count;
#if defined(__alpha__) && defined(__GNUC__)
uint32* pc;
#endif
LINT_INIT(fp);
#ifdef __i386__

View File

@@ -1050,8 +1050,6 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
ulong trc_level = trace_level_;
LINT_INIT_STRUCT(start_ts);
LINT_INIT_STRUCT(start_ts);
function_enter(kWho);
assert((unsigned char)event_buf[1] == kPacketMagicNum);

View File

@@ -3211,7 +3211,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];
int scramble_data_len, pkt_scramble_len= 0;
int scramble_data_len, UNINIT_VAR(pkt_scramble_len);
char *end,*host_info= 0, *server_version_end, *pkt_end;
char *scramble_data;
const char *scramble_plugin;
@@ -3224,7 +3224,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
struct sockaddr_un UNIXaddr;
#endif
DBUG_ENTER("mysql_real_connect");
LINT_INIT(pkt_scramble_len);
DBUG_PRINT("enter",("host: %s db: %s user: %s (client)",
host ? host : "(Null)",

View File

@@ -762,9 +762,8 @@ engine_option_value *merge_engine_table_options(engine_option_value *first,
engine_option_value *second,
MEM_ROOT *root)
{
engine_option_value *end, *opt;
engine_option_value *UNINIT_VAR(end), *opt;
DBUG_ENTER("merge_engine_table_options");
LINT_INIT(end);
/* Create copy of first list */
for (opt= first, first= 0; opt; opt= opt->next)

View File

@@ -1348,8 +1348,7 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
if (action->execute)
{
const char *old_proc_info;
LINT_INIT(old_proc_info);
const char *UNINIT_VAR(old_proc_info);
action->execute--;

View File

@@ -152,13 +152,11 @@ bool read_texts(const char *file_name, const char *language,
File file;
char name[FN_REFLEN];
char lang_path[FN_REFLEN];
uchar *buff;
uchar *UNINIT_VAR(buff);
uchar head[32],*pos;
DBUG_ENTER("read_texts");
*point= 0;
LINT_INIT(buff);
funktpos=0;
convert_dirname(lang_path, language, NullS);
(void) my_load_path(lang_path, lang_path, lc_messages_dir);

View File

@@ -414,9 +414,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
CHARSET_INFO *scs= system_charset_info;
KEY *key_info;
uint key_len;
uchar *key_buf= NULL;
LINT_INIT(key_buf);
uchar *key_buf;
DBUG_ENTER("Event_db_repository::index_read_for_db_for_i_s");
DBUG_PRINT("info", ("Using prefix scanning on PK"));

View File

@@ -5418,8 +5418,7 @@ int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
int error, error1;
LINT_INIT(error1);
int error, UNINIT_VAR(error1);
error= ha_index_init(index, 0);
if (!error)

View File

@@ -470,8 +470,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
my_bitmap_map *old_maps[2];
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
LINT_INIT(old_maps[0]);
LINT_INIT(old_maps[1]);
LINT_INIT_STRUCT(old_maps);
/* table->read_set may not be set if we come here from a CREATE TABLE */
if (table && table->read_set)

View File

@@ -1948,8 +1948,7 @@ String *Item_func_ltrim::val_str(String *str)
char buff[MAX_FIELD_WIDTH], *ptr, *end;
String tmp(buff,sizeof(buff),system_charset_info);
String *res, *remove_str;
uint remove_length;
LINT_INIT(remove_length);
uint UNINIT_VAR(remove_length);
res= args[0]->val_str(str);
if ((null_value=args[0]->null_value))
@@ -1994,8 +1993,7 @@ String *Item_func_rtrim::val_str(String *str)
char buff[MAX_FIELD_WIDTH], *ptr, *end;
String tmp(buff, sizeof(buff), system_charset_info);
String *res, *remove_str;
uint remove_length;
LINT_INIT(remove_length);
uint UNINIT_VAR(remove_length);
res= args[0]->val_str(str);
if ((null_value=args[0]->null_value))
@@ -2075,8 +2073,7 @@ String *Item_func_trim::val_str(String *str)
const char *r_ptr;
String tmp(buff, sizeof(buff), system_charset_info);
String *res, *remove_str;
uint remove_length;
LINT_INIT(remove_length);
uint UNINIT_VAR(remove_length);
res= args[0]->val_str(str);
if ((null_value=args[0]->null_value))

View File

@@ -656,9 +656,8 @@ int key_tuple_cmp(KEY_PART_INFO *part, uchar *key1, uchar *key2,
uint tuple_length)
{
uchar *key1_end= key1 + tuple_length;
int len;
int UNINIT_VAR(len);
int res;
LINT_INIT(len);
for (;key1 < key1_end; key1 += len, key2 += len, part++)
{
len= part->store_length;
@@ -709,12 +708,9 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
for (; key_part < end_key_part; key_part++)
{
uchar *pos= (uchar*)key;
CHARSET_INFO *cs;
uint length, pack_length;
CHARSET_INFO *UNINIT_VAR(cs);
uint UNINIT_VAR(length), UNINIT_VAR(pack_length);
bool is_string= TRUE;
LINT_INIT(cs);
LINT_INIT(length);
LINT_INIT(pack_length);
key+= key_part->length;
if (key_part->null_bit)
@@ -816,13 +812,9 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
{
uchar *pos1= (uchar*)key1;
uchar *pos2= (uchar*)key2;
CHARSET_INFO *cs;
uint length1, length2, pack_length;
CHARSET_INFO *UNINIT_VAR(cs);
uint UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length);
bool is_string= TRUE;
LINT_INIT(cs);
LINT_INIT(length1);
LINT_INIT(length2);
LINT_INIT(pack_length);
key1+= key_part->length;
key2+= key_part->length;

View File

@@ -1502,8 +1502,7 @@ bool LOGGER::activate_log_handler(THD* thd, uint log_type)
void LOGGER::deactivate_log_handler(THD *thd, uint log_type)
{
my_bool *tmp_opt= 0;
MYSQL_LOG *file_log;
LINT_INIT(file_log);
MYSQL_LOG *UNINIT_VAR(file_log);
switch (log_type) {
case QUERY_LOG_SLOW:
@@ -4878,8 +4877,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock)
char new_name[FN_REFLEN], *new_name_ptr, *old_name, *file_to_open;
uint close_flag;
bool delay_close= false;
File old_file;
LINT_INIT(old_file);
File UNINIT_VAR(old_file);
DBUG_ENTER("MYSQL_BIN_LOG::new_file_impl");
if (!is_open())
@@ -5873,9 +5871,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
bool is_trans_cache= FALSE;
bool using_trans= event_info->use_trans_cache();
bool direct= event_info->use_direct_logging();
ulong prev_binlog_id;
ulong UNINIT_VAR(prev_binlog_id);
DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
LINT_INIT(prev_binlog_id);
if (thd->variables.option_bits & OPTION_GTID_BEGIN)
{
@@ -7316,10 +7313,9 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
group_commit_entry *current, *last_in_queue;
group_commit_entry *queue= NULL;
bool check_purge= false;
ulong binlog_id;
ulong UNINIT_VAR(binlog_id);
uint64 commit_id;
DBUG_ENTER("MYSQL_BIN_LOG::trx_group_commit_leader");
LINT_INIT(binlog_id);
{
DBUG_EXECUTE_IF("inject_binlog_commit_before_get_LOCK_log",
@@ -8297,8 +8293,7 @@ int TC_LOG_MMAP::log_and_order(THD *thd, my_xid xid, bool all,
{
int cookie;
struct commit_entry entry;
bool is_group_commit_leader;
LINT_INIT(is_group_commit_leader);
bool UNINIT_VAR(is_group_commit_leader);
if (need_prepare_ordered)
{
@@ -9794,8 +9789,7 @@ binlog_checksum_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
{
ulong value= *((ulong *)save);
bool check_purge= false;
ulong prev_binlog_id;
LINT_INIT(prev_binlog_id);
ulong UNINIT_VAR(prev_binlog_id);
mysql_mutex_lock(mysql_bin_log.get_log_lock());
if(mysql_bin_log.is_open())

View File

@@ -7063,8 +7063,7 @@ bool Intvar_log_event::write(IO_CACHE* file)
void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
{
char llbuff[22];
const char *msg;
LINT_INIT(msg);
const char *UNINIT_VAR(msg);
Write_on_release_cache cache(&print_event_info->head_cache, file,
Write_on_release_cache::FLUSH_F);
@@ -11709,14 +11708,12 @@ record_compare_exit:
int Rows_log_event::find_key()
{
uint i, best_key_nr, last_part;
KEY *key, *best_key;
ulong best_rec_per_key, tmp;
KEY *key, *UNINIT_VAR(best_key);
ulong UNINIT_VAR(best_rec_per_key), tmp;
DBUG_ENTER("Rows_log_event::find_key");
DBUG_ASSERT(m_table);
best_key_nr= MAX_KEY;
LINT_INIT(best_key);
LINT_INIT(best_rec_per_key);
/*
Keys are sorted so that any primary key is first, followed by unique keys,

View File

@@ -817,12 +817,11 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
THD *thd= current_thd;
int res;
Key_parameters keypar;
uint key_buff_elem_size;
uint UNINIT_VAR(key_buff_elem_size); /* set/used when do_sort_keys==TRUE */
handler *h_idx;
Mrr_ordered_rndpos_reader *disk_strategy= NULL;
bool do_sort_keys= FALSE;
DBUG_ENTER("DsMrr_impl::dsmrr_init");
LINT_INIT(key_buff_elem_size); /* set/used when do_sort_keys==TRUE */
/*
index_merge may invoke a scan on an object for which dsmrr_info[_const]
has not been called, so set the owner handler here as well.

View File

@@ -1540,8 +1540,7 @@ static void close_connections(void)
while (select_thread_in_use)
{
struct timespec abstime;
int error;
LINT_INIT(error);
int UNINIT_VAR(error);
DBUG_PRINT("info",("Waiting for select thread"));
#ifndef DONT_USE_THR_ALARM
@@ -7533,8 +7532,7 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
Master_info *mi= NULL;
bool tmp;
LINT_INIT(tmp);
bool UNINIT_VAR(tmp);
var->type= SHOW_MY_BOOL;
var->value= buff;
@@ -7561,8 +7559,7 @@ static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
Master_info *mi= NULL;
longlong tmp;
LINT_INIT(tmp);
longlong UNINIT_VAR(tmp);
var->type= SHOW_LONGLONG;
var->value= buff;
@@ -7588,8 +7585,7 @@ static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
Master_info *mi= NULL;
float tmp;
LINT_INIT(tmp);
float UNINIT_VAR(tmp);
var->type= SHOW_CHAR;
var->value= buff;

View File

@@ -3235,8 +3235,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
{
/* Try creating index_merge/ROR-union scan. */
SEL_IMERGE *imerge;
TABLE_READ_PLAN *best_conj_trp= NULL, *new_conj_trp;
LINT_INIT(new_conj_trp); /* no empty index_merge lists possible */
TABLE_READ_PLAN *best_conj_trp= NULL,
*UNINIT_VAR(new_conj_trp); /* no empty index_merge lists possible */
DBUG_PRINT("info",("No range reads possible,"
" trying to construct index_merge"));
List_iterator_fast<SEL_IMERGE> it(tree->merges);

View File

@@ -3288,8 +3288,7 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
{
POSITION *pos= join->best_positions + tablenr;
JOIN_TAB *s= pos->table;
uint first;
LINT_INIT(first); // Set by every branch except SJ_OPT_NONE which doesn't use it
uint UNINIT_VAR(first); // Set by every branch except SJ_OPT_NONE which doesn't use it
if ((handled_tabs & s->table->map) || pos->sj_strategy == SJ_OPT_NONE)
{

View File

@@ -2047,8 +2047,7 @@ bool partition_info::set_up_charset_field_preps()
i= 0;
while ((field= *(ptr++)))
{
uchar *field_buf;
LINT_INIT(field_buf);
uchar *UNINIT_VAR(field_buf);
if (!field_is_partition_charset(field))
continue;

View File

@@ -3570,8 +3570,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
if (slave_trans_retries)
{
int temp_err;
LINT_INIT(temp_err);
int UNINIT_VAR(temp_err);
if (exec_res && (temp_err= has_temporary_error(thd)))
{
const char *errmsg;

View File

@@ -1695,7 +1695,7 @@ bool
sp_head::execute_function(THD *thd, Item **argp, uint argcount,
Field *return_value_fld)
{
ulonglong binlog_save_options;
ulonglong UNINIT_VAR(binlog_save_options);
bool need_binlog_call= FALSE;
uint arg_no;
sp_rcontext *octx = thd->spcont;
@@ -1709,8 +1709,6 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
DBUG_ENTER("sp_head::execute_function");
DBUG_PRINT("info", ("function %s", m_name.str));
LINT_INIT(binlog_save_options);
/*
Check that the function is called with all specified arguments.

View File

@@ -6071,17 +6071,14 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
List_iterator_fast<Natural_join_column>
field_it(*(table_ref->join_columns));
Natural_join_column *nj_col, *curr_nj_col;
Field *found_field;
Query_arena *arena, backup;
Field *UNINIT_VAR(found_field);
Query_arena *UNINIT_VAR(arena), backup;
DBUG_ENTER("find_field_in_natural_join");
DBUG_PRINT("enter", ("field name: '%s', ref 0x%lx",
name, (ulong) ref));
DBUG_ASSERT(table_ref->is_natural_join && table_ref->join_columns);
DBUG_ASSERT(*actual_table == NULL);
LINT_INIT(arena);
LINT_INIT(found_field);
for (nj_col= NULL, curr_nj_col= field_it++; curr_nj_col;
curr_nj_col= field_it++)
{
@@ -6101,7 +6098,6 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
if (nj_col->view_field)
{
Item *item;
LINT_INIT(arena);
if (register_tree_change)
arena= thd->activate_stmt_arena_if_needed(&backup);
/*

View File

@@ -331,8 +331,7 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
table_map *map)
{
TABLE *table= insert_table_list->table;
my_bool autoinc_mark;
LINT_INIT(autoinc_mark);
my_bool UNINIT_VAR(autoinc_mark);
table->next_number_field_updated= FALSE;

View File

@@ -1028,7 +1028,7 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
static int lex_one_token(YYSTYPE *yylval, THD *thd)
{
reg1 uchar c;
reg1 uchar UNINIT_VAR(c);
bool comment_closed;
int tokval, result_state;
uint length;
@@ -1039,7 +1039,6 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
const uchar *const state_map= cs->state_map;
const uchar *const ident_map= cs->ident_map;
LINT_INIT(c);
lip->yylval=yylval; // The global state
lip->start_token();

View File

@@ -7310,11 +7310,10 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
LEX_STRING *option)
{
register TABLE_LIST *ptr;
TABLE_LIST *previous_table_ref; /* The table preceding the current one. */
TABLE_LIST *UNINIT_VAR(previous_table_ref); /* The table preceding the current one. */
char *alias_str;
LEX *lex= thd->lex;
DBUG_ENTER("add_table_to_list");
LINT_INIT(previous_table_ref);
if (!table)
DBUG_RETURN(0); // End of memory

View File

@@ -3397,7 +3397,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
DYNAMIC_ARRAY *keyuse_array)
{
int error= 0;
TABLE *table;
TABLE *UNINIT_VAR(table); /* inited in all loops */
uint i,table_count,const_count,key;
table_map found_const_table_map, all_table_map, found_ref, refs;
key_map const_ref, eq_part;
@@ -3412,7 +3412,6 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
TABLE_LIST *tables;
DBUG_ENTER("make_join_statistics");
LINT_INIT(table); /* inited in all loops */
table_count=join->table_count;
/*
@@ -12036,13 +12035,12 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
return change_list ? 0 : first_order; // No need to sort
ORDER *order,**prev_ptr, *tmp_order;
table_map first_table;
table_map UNINIT_VAR(first_table); /* protected by first_is_base_table */
table_map not_const_tables= ~join->const_table_map;
table_map ref;
bool first_is_base_table= FALSE;
DBUG_ENTER("remove_const");
LINT_INIT(first_table); /* protected by first_is_base_table */
if (join->join_tab[join->const_tables].table)
{
first_table= join->join_tab[join->const_tables].table->map;
@@ -15468,8 +15466,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
uint convert_blob_length)
{
bool maybe_null= item->maybe_null;
Field *new_field;
LINT_INIT(new_field);
Field *UNINIT_VAR(new_field);
switch (item->result_type()) {
case REAL_RESULT:
@@ -17462,9 +17459,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
{
int rc= 0;
enum_nested_loop_state error= NESTED_LOOP_OK;
JOIN_TAB *join_tab;
JOIN_TAB *UNINIT_VAR(join_tab);
DBUG_ENTER("do_select");
LINT_INIT(join_tab);
join->procedure=procedure;
join->tmp_table= table; /* Save for easy recursion */

View File

@@ -762,7 +762,7 @@ public:
void set_empty()
{
sjm_scan_need_tables= 0;
LINT_INIT(sjm_scan_last_inner);
LINT_INIT_STRUCT(sjm_scan_last_inner);
is_used= FALSE;
}
void set_from_prev(struct st_position *prev);

View File

@@ -1551,7 +1551,7 @@ public:
uint key_parts= table->actual_n_key_parts(key_info);
empty= TRUE;
prefixes= 0;
LINT_INIT(calc_state);
LINT_INIT_STRUCT(calc_state);
is_single_comp_pk= FALSE;
uint pk= table->s->primary_key;

View File

@@ -545,8 +545,7 @@ bool parse_date_time_format(timestamp_type format_type,
{
if (*ptr == '%' && ptr+1 != end)
{
uint position;
LINT_INIT(position);
uint UNINIT_VAR(position);
switch (*++ptr) {
case 'y': // Year
case 'Y':

View File

@@ -4826,9 +4826,8 @@ bool TABLE_LIST::is_leaf_for_name_resolution()
TABLE_LIST *TABLE_LIST::first_leaf_for_name_resolution()
{
TABLE_LIST *cur_table_ref;
TABLE_LIST *UNINIT_VAR(cur_table_ref);
NESTED_JOIN *cur_nested_join;
LINT_INIT(cur_table_ref);
if (is_leaf_for_name_resolution())
return this;
@@ -5547,10 +5546,9 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
{
Natural_join_column *nj_col;
bool is_created= TRUE;
uint field_count;
uint UNINIT_VAR(field_count);
TABLE_LIST *add_table_ref= parent_table_ref ?
parent_table_ref : table_ref;
LINT_INIT(field_count);
if (field_it == &table_field_it)
{

View File

@@ -327,7 +327,7 @@ static my_bool
prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage)
{
my_time_t cur_t= MY_TIME_T_MIN;
my_time_t cur_l, end_t, end_l;
my_time_t cur_l, end_t, UNINIT_VAR(end_l);
my_time_t cur_max_seen_l= MY_TIME_T_MIN;
long cur_offset, cur_corr, cur_off_and_corr;
uint next_trans_idx, next_leap_idx;
@@ -340,8 +340,6 @@ prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage)
my_time_t revts[TZ_MAX_REV_RANGES];
REVT_INFO revtis[TZ_MAX_REV_RANGES];
LINT_INIT(end_l);
/*
Let us setup fallback time type which will be used if we have not any
transitions or if we have moment of time before first transition.

View File

@@ -1721,11 +1721,10 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
uint full_page_size= FULL_PAGE_SIZE(info->s);
ulong pages;
uint rest_length, used;
uint first_block_pos;
uint UNINIT_VAR(first_block_pos);
MARIA_BITMAP_BLOCK *first_block= 0;
DBUG_ENTER("find_blob");
DBUG_PRINT("enter", ("length: %lu", length));
LINT_INIT(first_block_pos);
pages= length / full_page_size;
rest_length= (uint) (length - pages * full_page_size);

View File

@@ -1862,8 +1862,6 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
page_type, bitmap_pattern;
uint bitmap_for_page;
LINT_INIT(empty_space);
if (_ma_killed_ptr(param))
{
_ma_scan_end_block_record(info);

View File

@@ -1593,9 +1593,8 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
uchar *buffer;
MARIA_BLOCK_INFO block_info;
my_bool error= 1;
size_t buffer_length;
size_t UNINIT_VAR(buffer_length);
DBUG_ENTER("_ma_cmp_dynamic_record");
LINT_INIT(buffer_length);
if (info->opt_flag & WRITE_CACHE_USED)
{

View File

@@ -83,8 +83,6 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error
#endif
DBUG_ENTER("walk_and_match");
LINT_INIT(subkeys.i);
LINT_INIT_STRUCT(subkeys);
word->weight=LWS_FOR_QUERY;

View File

@@ -280,7 +280,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN],
data_name[FN_REFLEN];
uchar *disk_cache, *disk_pos, *end_pos;
MARIA_HA info,*m_info,*old_info;
MARIA_HA info, *UNINIT_VAR(m_info), *old_info;
MARIA_SHARE share_buff,*share;
double *rec_per_key_part;
ulong *nulls_per_key_part;
@@ -290,7 +290,6 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
File data_file= -1;
DBUG_ENTER("maria_open");
LINT_INIT(m_info);
kfile= -1;
errpos= 0;
head_length=sizeof(share_buff.state.header);

View File

@@ -3370,8 +3370,7 @@ restart:
/* Key cache is used */
PAGECACHE_BLOCK_LINK *block;
uint status;
int page_st;
LINT_INIT(page_st);
int UNINIT_VAR(page_st);
pagecache_pthread_mutex_lock(&pagecache->cache_lock);
if (!pagecache->can_be_used)

View File

@@ -209,14 +209,13 @@ static double _ma_search_pos(MARIA_HA *info, MARIA_KEY *key,
uint32 nextflag, my_off_t pos)
{
int flag;
uint keynr, max_keynr;
uint keynr, UNINIT_VAR(max_keynr);
my_bool after_key;
uchar *keypos;
double offset;
MARIA_KEYDEF *keyinfo= key->keyinfo;
MARIA_PAGE page;
DBUG_ENTER("_ma_search_pos");
LINT_INIT(max_keynr);
if (pos == HA_OFFSET_ERROR)
DBUG_RETURN(0.0);

View File

@@ -523,19 +523,15 @@ static const uchar *maria_rtree_pick_key(const MARIA_KEY *key,
const MARIA_PAGE *page)
{
double increase;
double best_incr;
double UNINIT_VAR(best_incr);
double perimeter;
double best_perimeter;
double UNINIT_VAR(best_perimeter);
uchar *best_key= NULL;
const MARIA_HA *info= page->info;
uchar *k= rt_PAGE_FIRST_KEY(info->s, page->buf, page->node);
uchar *last= rt_PAGE_END(info, page);
LINT_INIT(best_perimeter);
LINT_INIT(best_key);
LINT_INIT(best_incr);
for (; k < last; k= rt_PAGE_NEXT_KEY(k, key->data_length, nod_flag))
{
if ((increase= maria_rtree_perimeter_increase(keyinfo->seg, k, key,
@@ -563,13 +559,11 @@ static const uchar *maria_rtree_pick_key(const MARIA_KEY *key,
double increase;
double best_incr= DBL_MAX;
double area;
double best_area;
double UNINIT_VAR(best_area);
const uchar *best_key= NULL;
const uchar *k= rt_PAGE_FIRST_KEY(share, page->buff, page->node);
const uchar *last= rt_PAGE_END(page);
LINT_INIT(best_area);
for (; k < last;
k= rt_PAGE_NEXT_KEY(share, k, key->data_length, page->node))
{

View File

@@ -269,7 +269,7 @@ int _ma_bin_search(const MARIA_KEY *key, const MARIA_PAGE *ma_page,
uint32 comp_flag, uchar **ret_pos,
uchar *buff __attribute__((unused)), my_bool *last_key)
{
int flag;
int UNINIT_VAR(flag);
uint page_flag;
uint start, mid, end, save_end, totlength, nod_flag;
uint not_used[2];
@@ -278,8 +278,6 @@ int _ma_bin_search(const MARIA_KEY *key, const MARIA_PAGE *ma_page,
uchar *page;
DBUG_ENTER("_ma_bin_search");
LINT_INIT(flag);
page_flag= ma_page->flag;
if (page_flag & KEYPAGE_FLAG_HAS_TRANSID)
{

View File

@@ -110,7 +110,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
uint sort_length, maxbuffer;
size_t memavl, old_memavl;
DYNAMIC_ARRAY buffpek;
ha_rows records, keys;
ha_rows records, UNINIT_VAR(keys);
uchar **sort_keys;
IO_CACHE tempfile, tempfile_for_exceptions;
DBUG_ENTER("_ma_create_index_by_sort");
@@ -140,7 +140,6 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
memavl=MY_MAX(sortbuff_size,MIN_SORT_MEMORY);
records= info->sort_info->max_records;
sort_length= info->key_length;
LINT_INIT(keys);
while (memavl >= MIN_SORT_MEMORY)
{
@@ -363,13 +362,11 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
int error;
size_t memavl, old_memavl;
longlong sortbuff_size;
ha_keys keys, idx;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
uint maxbuffer;
uchar **sort_keys=0;
LINT_INIT(keys);
error=1;
if (my_thread_init())
@@ -1029,7 +1026,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ha_keys keys, IO_CACHE *from_file,
count= 0;
maxcount= keys/((uint) (Tb-Fb) +1);
DBUG_ASSERT(maxcount > 0);
LINT_INIT(to_start_filepos);
if (to_file)
to_start_filepos=my_b_tell(to_file);
strpos= (uchar*) sort_keys;

View File

@@ -26,14 +26,12 @@ int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec)
int flag,key_changed,save_errno;
reg3 my_off_t pos;
uint i;
uchar old_key_buff[MARIA_MAX_KEY_BUFF],*new_key_buff;
uchar old_key_buff[MARIA_MAX_KEY_BUFF], *UNINIT_VAR(new_key_buff);
my_bool auto_key_changed= 0;
ulonglong changed;
ulonglong UNINIT_VAR(changed);
MARIA_SHARE *share= info->s;
MARIA_KEYDEF *keyinfo;
DBUG_ENTER("maria_update");
LINT_INIT(new_key_buff);
LINT_INIT(changed);
DBUG_EXECUTE_IF("maria_pretend_crashed_table_on_usage",
maria_print_error(info->s, HA_ERR_CRASHED);

View File

@@ -977,7 +977,7 @@ int _ma_split_page(MARIA_HA *info, MARIA_KEY *key, MARIA_PAGE *split_page,
uint keynr;
uint length,a_length,key_ref_length,t_length,nod_flag,key_length;
uint page_length, split_length, page_flag;
uchar *key_pos,*pos, *after_key;
uchar *key_pos, *pos, *UNINIT_VAR(after_key);
MARIA_KEY_PARAM s_temp;
MARIA_PINNED_PAGE tmp_page_link, *page_link= &tmp_page_link;
MARIA_SHARE *share= info->s;
@@ -987,7 +987,6 @@ int _ma_split_page(MARIA_HA *info, MARIA_KEY *key, MARIA_PAGE *split_page,
int res;
DBUG_ENTER("_ma_split_page");
LINT_INIT(after_key);
DBUG_DUMP("buff", split_page->buff, split_page->size);
info->page_changed=1; /* Info->buff is used */

View File

@@ -3292,7 +3292,6 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
}
}
case DYNAMIC_RECORD:
LINT_INIT(to);
pos=sort_param->pos;
searching=(sort_param->fix_datafile && (param->testflag & T_EXTEND));
parallel_flag= (sort_param->read_cache.file < 0) ? READING_NEXT : 0;

View File

@@ -305,7 +305,6 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
}
}
leaf_buff=0;
LINT_INIT(leaf_page);
if (nod_flag)
{
leaf_page=_mi_kpos(nod_flag,keypos);

View File

@@ -721,7 +721,6 @@ uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf)
{
uint extra;
uint32 UNINIT_VAR(old_length);
LINT_INIT(old_length);
if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf)))
{

View File

@@ -1364,7 +1364,6 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
{
uchar *header=info->header;
uint head_length, UNINIT_VAR(ref_length);
LINT_INIT(ref_length);
if (file >= 0)
{

View File

@@ -187,11 +187,10 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
uchar *buff __attribute__((unused)), my_bool *last_key)
{
reg4 int start,mid,end,save_end;
int flag;
int UNINIT_VAR(flag);
uint totlength,nod_flag,not_used[2];
DBUG_ENTER("_mi_bin_search");
LINT_INIT(flag);
totlength=keyinfo->keylength+(nod_flag=mi_test_if_nod(page));
start=0; mid=1;
save_end=end=(int) ((mi_getint(page)-2-nod_flag)/totlength-1);

View File

@@ -595,11 +595,10 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_bool insert_last_key)
{
uint length,a_length,key_ref_length,t_length,nod_flag,key_length;
uchar *key_pos,*pos, *after_key;
uchar *key_pos,*pos, *UNINIT_VAR(after_key);
my_off_t new_pos;
MI_KEY_PARAM s_temp;
DBUG_ENTER("mi_split_page");
LINT_INIT(after_key);
DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
if (info->s->keyinfo+info->lastinx == keyinfo)
@@ -710,13 +709,11 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page,
uchar *key, uint *return_key_length,
uchar **after_key)
{
uint keys,length,last_length,key_ref_length;
uint keys, length, UNINIT_VAR(last_length), key_ref_length;
uchar *end,*lastpos,*prevpos;
uchar key_buff[HA_MAX_KEY_BUFF];
DBUG_ENTER("_mi_find_last_pos");
LINT_INIT(last_length);
key_ref_length=2;
length=mi_getint(page)-key_ref_length;
page+=key_ref_length;

View File

@@ -469,14 +469,11 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
double increase;
double best_incr = DBL_MAX;
double perimeter;
double best_perimeter;
uchar *best_key;
double UNINIT_VAR(best_perimeter);
uchar *UNINIT_VAR(best_key);
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_perimeter);
LINT_INIT(best_key);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
if ((increase = rtree_perimeter_increase(keyinfo->seg, k, key, key_length,

View File

@@ -107,7 +107,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
uint sort_length, maxbuffer;
ulonglong memavl, old_memavl;
DYNAMIC_ARRAY buffpek;
ha_rows records, keys;
ha_rows records, UNINIT_VAR(keys);
uchar **sort_keys;
IO_CACHE tempfile, tempfile_for_exceptions;
DBUG_ENTER("_create_index_by_sort");
@@ -135,7 +135,6 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
memavl= MY_MAX(sortbuff_size, MIN_SORT_BUFFER);
records= info->sort_info->max_records;
sort_length= info->key_length;
LINT_INIT(keys);
while (memavl >= MIN_SORT_BUFFER)
{
@@ -342,13 +341,11 @@ pthread_handler_t thr_find_all_keys(void *arg)
MI_SORT_PARAM *sort_param= (MI_SORT_PARAM*) arg;
int error;
ulonglong memavl, old_memavl, sortbuff_size;
ha_keys keys, idx;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
uint maxbuffer;
uchar **sort_keys=0;
LINT_INIT(keys);
error=1;
if (my_thread_init())
@@ -552,7 +549,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
MI_SORT_PARAM *sinfo;
uchar *mergebuf=0;
DBUG_ENTER("thr_write_keys");
LINT_INIT(length);
for (i= 0, sinfo= sort_param ;
i < sort_info->total_keys ;
@@ -977,7 +973,6 @@ merge_buffers(MI_SORT_PARAM *info, ha_keys keys, IO_CACHE *from_file,
count=error=0;
maxcount= keys/((uint) (Tb-Fb) +1);
DBUG_ASSERT(maxcount > 0);
LINT_INIT(to_start_filepos);
if (to_file)
to_start_filepos=my_b_tell(to_file);
strpos=(uchar*) sort_keys;

View File

@@ -239,7 +239,6 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
rc= 1;
errpos= 0;
bzero((char*) &file_cache, sizeof(file_cache));
LINT_INIT(m_info);
/* Open MERGE meta file. */
if ((fd= mysql_file_open(rg_key_file_MRG,

View File

@@ -4064,7 +4064,7 @@ bool ha_tokudb::key_changed(uint keynr, const uchar * old_row, const uchar * new
int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
TOKUDB_HANDLER_DBUG_ENTER("");
DBT prim_key, old_prim_key, prim_row, old_prim_row;
int error;
int UNINIT_VAR(error);
bool has_null;
THD* thd = ha_thd();
DB_TXN* sub_trans = NULL;
@@ -4072,7 +4072,6 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
tokudb_trx_data* trx = (tokudb_trx_data *) thd_get_ha_data(thd, tokudb_hton);
uint curr_num_DBs;
LINT_INIT(error);
memset((void *) &prim_key, 0, sizeof(prim_key));
memset((void *) &old_prim_key, 0, sizeof(old_prim_key));
memset((void *) &prim_row, 0, sizeof(prim_row));

View File

@@ -4629,14 +4629,13 @@ my_strnxfrm_unicode(CHARSET_INFO *cs,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags)
{
my_wc_t wc;
my_wc_t UNINIT_VAR(wc);
int res;
uchar *dst0= dst;
uchar *de= dst + dstlen;
const uchar *se= src + srclen;
MY_UNICASE_INFO *uni_plane= (cs->state & MY_CS_BINSORT) ?
NULL : cs->caseinfo;
LINT_INIT(wc);
DBUG_ASSERT(!srclen || src);
for (; dst < de && nweights; nweights--)
@@ -4683,12 +4682,11 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags)
{
my_wc_t wc;
my_wc_t UNINIT_VAR(wc);
uchar *dst0= dst;
uchar *de= dst + dstlen;
const uchar *se = src + srclen;
LINT_INIT(wc);
DBUG_ASSERT(!srclen || src);
DBUG_ASSERT(cs->state & MY_CS_BINSORT);
@@ -7764,12 +7762,10 @@ my_strnncoll_utf8mb4(CHARSET_INFO *cs,
const uchar *t, size_t tlen,
my_bool t_is_prefix)
{
my_wc_t s_wc,t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(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 )
{
@@ -7832,11 +7828,9 @@ my_strnncollsp_utf8mb4(CHARSET_INFO *cs,
my_bool diff_if_only_endspace_difference)
{
int res;
my_wc_t s_wc, t_wc;
my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(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= FALSE;