Commit 99efc2ae authored by marko's avatar marko

branches/zip: Initialize some uninitialized variables in order to avoid

comparing uninitialized values.

dict_mem_table_create(): Initialize table->version_number.

ins_node_create(): Initialize node->table_version_number.

row_create_prebuilt(): Initialize all fields.  Initialize most fields
by memset(), so that any fields that are added will be initialized
automatically.
parent dcad18b1
......@@ -52,6 +52,7 @@ dict_mem_table_create(
table->flags = (unsigned int) flags;
table->name = mem_heap_strdup(heap, name);
table->dir_path_of_temp_table = NULL;
table->version_number = 0;
table->space = (unsigned int) space;
table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE;
......
......@@ -72,6 +72,7 @@ ins_node_create(
node->state = INS_NODE_SET_IX_LOCK;
node->table = table;
node->table_version_number = table->version_number;
node->index = NULL;
node->entry = NULL;
......
......@@ -592,38 +592,20 @@ row_create_prebuilt(
dict_index_t* clust_index;
dtuple_t* ref;
ulint ref_len;
ulint i;
heap = mem_heap_create(128);
heap = mem_heap_create(sizeof *prebuilt + 128);
prebuilt = mem_heap_alloc(heap, sizeof *prebuilt);
prebuilt = mem_heap_alloc(heap, sizeof(row_prebuilt_t));
memset(prebuilt, 0, sizeof *prebuilt);
prebuilt->magic_n = ROW_PREBUILT_ALLOCATED;
prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED;
prebuilt->table = table;
prebuilt->trx = NULL;
prebuilt->sql_stat_start = TRUE;
prebuilt->mysql_has_locked = FALSE;
prebuilt->index = NULL;
prebuilt->used_in_HANDLER = FALSE;
prebuilt->n_template = 0;
prebuilt->mysql_template = NULL;
prebuilt->heap = heap;
prebuilt->ins_node = NULL;
prebuilt->ins_upd_rec_buff = NULL;
prebuilt->upd_node = NULL;
prebuilt->ins_graph = NULL;
prebuilt->upd_graph = NULL;
prebuilt->pcur = btr_pcur_create_for_mysql();
prebuilt->clust_pcur = btr_pcur_create_for_mysql();
......@@ -631,10 +613,6 @@ row_create_prebuilt(
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = 99999999;
prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
prebuilt->sel_graph = NULL;
prebuilt->search_tuple = dtuple_create(
heap, 2 * dict_table_get_n_cols(table));
......@@ -651,16 +629,6 @@ row_create_prebuilt(
prebuilt->clust_ref = ref;
for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) {
prebuilt->fetch_cache[i] = NULL;
}
prebuilt->n_fetch_cached = 0;
prebuilt->blob_heap = NULL;
prebuilt->old_vers_heap = NULL;
UT_LIST_ADD_LAST(prebuilts, table->prebuilts, prebuilt);
return(prebuilt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment