Commit 3877f691 authored by marko's avatar marko

branches/zip: Define the macro rec_offs_init() and use it for initializing

offsets_[] arrays, as suggested by Vasil.

rec_offs_set_n_alloc(): Declare as a public function.  Assert that
n_alloc > REC_OFFS_HEADER_SIZE.

rec_offs_get_n_alloc(): Assert that n_alloc > REC_OFFS_HEADER_SIZE.
parent d67cc23e
...@@ -2847,7 +2847,7 @@ btr_print_index( ...@@ -2847,7 +2847,7 @@ btr_print_index(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
fputs("--------------------------\n" fputs("--------------------------\n"
"INDEX TREE PRINT\n", stderr); "INDEX TREE PRINT\n", stderr);
...@@ -2949,7 +2949,7 @@ btr_index_rec_validate( ...@@ -2949,7 +2949,7 @@ btr_index_rec_validate(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
page = page_align(rec); page = page_align(rec);
......
...@@ -330,7 +330,7 @@ btr_cur_search_to_nth_level( ...@@ -330,7 +330,7 @@ btr_cur_search_to_nth_level(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
/* Currently, PAGE_CUR_LE is the only search mode used for searches /* Currently, PAGE_CUR_LE is the only search mode used for searches
ending to upper levels */ ending to upper levels */
...@@ -654,7 +654,7 @@ btr_cur_open_at_index_side( ...@@ -654,7 +654,7 @@ btr_cur_open_at_index_side(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
estimate = latch_mode & BTR_ESTIMATE; estimate = latch_mode & BTR_ESTIMATE;
latch_mode = latch_mode & ~BTR_ESTIMATE; latch_mode = latch_mode & ~BTR_ESTIMATE;
...@@ -781,7 +781,7 @@ btr_cur_open_at_rnd_pos( ...@@ -781,7 +781,7 @@ btr_cur_open_at_rnd_pos(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
if (latch_mode == BTR_MODIFY_TREE) { if (latch_mode == BTR_MODIFY_TREE) {
mtr_x_lock(dict_index_get_lock(index), mtr); mtr_x_lock(dict_index_get_lock(index), mtr);
...@@ -1446,7 +1446,7 @@ btr_cur_upd_lock_and_undo( ...@@ -1446,7 +1446,7 @@ btr_cur_upd_lock_and_undo(
if (!(flags & BTR_NO_LOCKING_FLAG)) { if (!(flags & BTR_NO_LOCKING_FLAG)) {
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
err = lock_clust_rec_modify_check_and_lock( err = lock_clust_rec_modify_check_and_lock(
flags, btr_cur_get_block(cursor), rec, index, flags, btr_cur_get_block(cursor), rec, index,
...@@ -1682,7 +1682,7 @@ btr_cur_update_in_place( ...@@ -1682,7 +1682,7 @@ btr_cur_update_in_place(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
index = cursor->index; index = cursor->index;
...@@ -2403,7 +2403,7 @@ btr_cur_parse_del_mark_set_clust_rec( ...@@ -2403,7 +2403,7 @@ btr_cur_parse_del_mark_set_clust_rec(
if (!(flags & BTR_KEEP_SYS_FLAG)) { if (!(flags & BTR_KEEP_SYS_FLAG)) {
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
row_upd_rec_sys_fields_in_recovery( row_upd_rec_sys_fields_in_recovery(
rec, page_zip, rec, page_zip,
...@@ -2446,7 +2446,7 @@ btr_cur_del_mark_set_clust_rec( ...@@ -2446,7 +2446,7 @@ btr_cur_del_mark_set_clust_rec(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
index = cursor->index; index = cursor->index;
...@@ -2711,7 +2711,7 @@ btr_cur_optimistic_delete( ...@@ -2711,7 +2711,7 @@ btr_cur_optimistic_delete(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
ibool no_compress_needed; ibool no_compress_needed;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor), ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
...@@ -3159,9 +3159,8 @@ btr_estimate_number_of_different_key_vals( ...@@ -3159,9 +3159,8 @@ btr_estimate_number_of_different_key_vals(
ulint offsets_next_rec_[REC_OFFS_NORMAL_SIZE]; ulint offsets_next_rec_[REC_OFFS_NORMAL_SIZE];
ulint* offsets_rec = offsets_rec_; ulint* offsets_rec = offsets_rec_;
ulint* offsets_next_rec= offsets_next_rec_; ulint* offsets_next_rec= offsets_next_rec_;
*offsets_rec_ = (sizeof offsets_rec_) / sizeof *offsets_rec_; rec_offs_init(offsets_rec_);
*offsets_next_rec_ rec_offs_init(offsets_next_rec_);
= (sizeof offsets_next_rec_) / sizeof *offsets_next_rec_;
n_cols = dict_index_get_n_unique(index); n_cols = dict_index_get_n_unique(index);
......
...@@ -447,7 +447,7 @@ btr_search_update_hash_ref( ...@@ -447,7 +447,7 @@ btr_search_update_hash_ref(
&& (block->curr_left_side == info->left_side)) { && (block->curr_left_side == info->left_side)) {
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
...@@ -583,7 +583,7 @@ btr_search_check_guess( ...@@ -583,7 +583,7 @@ btr_search_check_guess(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
ibool success = FALSE; ibool success = FALSE;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
n_unique = dict_index_get_n_unique_in_tree(cursor->index); n_unique = dict_index_get_n_unique_in_tree(cursor->index);
...@@ -1160,7 +1160,7 @@ btr_search_build_page_hash_index( ...@@ -1160,7 +1160,7 @@ btr_search_build_page_hash_index(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(index); ut_ad(index);
...@@ -1392,7 +1392,7 @@ btr_search_update_hash_on_delete( ...@@ -1392,7 +1392,7 @@ btr_search_update_hash_on_delete(
ibool found; ibool found;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
...@@ -1503,7 +1503,7 @@ btr_search_update_hash_on_insert( ...@@ -1503,7 +1503,7 @@ btr_search_update_hash_on_insert(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
table = btr_search_sys->hash_index; table = btr_search_sys->hash_index;
...@@ -1648,7 +1648,7 @@ btr_search_validate(void) ...@@ -1648,7 +1648,7 @@ btr_search_validate(void)
btr_search_latch. */ btr_search_latch. */
ulint chunk_size = 10000; ulint chunk_size = 10000;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
mutex_enter(&buf_pool->mutex); mutex_enter(&buf_pool->mutex);
......
...@@ -518,6 +518,18 @@ rec_get_data_size_old( ...@@ -518,6 +518,18 @@ rec_get_data_size_old(
/* out: size */ /* out: size */
const rec_t* rec); /* in: physical record */ const rec_t* rec); /* in: physical record */
/************************************************************** /**************************************************************
The following function sets the number of allocated elements
for an array of offsets. */
UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
ulint* offsets, /* out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc); /* in: number of elements */
#define rec_offs_init(offsets) \
rec_offs_set_n_alloc(offsets, (sizeof offsets) / sizeof *offsets)
/**************************************************************
The following function returns the number of fields in a record. */ The following function returns the number of fields in a record. */
UNIV_INLINE UNIV_INLINE
ulint ulint
......
...@@ -878,7 +878,8 @@ rec_offs_get_n_alloc( ...@@ -878,7 +878,8 @@ rec_offs_get_n_alloc(
ulint n_alloc; ulint n_alloc;
ut_ad(offsets); ut_ad(offsets);
n_alloc = offsets[0]; n_alloc = offsets[0];
ut_ad(n_alloc > 0); ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
UNIV_MEM_ASSERT_W(offsets, n_alloc * sizeof *offsets);
return(n_alloc); return(n_alloc);
} }
...@@ -894,7 +895,7 @@ rec_offs_set_n_alloc( ...@@ -894,7 +895,7 @@ rec_offs_set_n_alloc(
ulint n_alloc) /* in: number of elements */ ulint n_alloc) /* in: number of elements */
{ {
ut_ad(offsets); ut_ad(offsets);
ut_ad(n_alloc > 0); ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
UNIV_MEM_ASSERT_AND_ALLOC(offsets, n_alloc * sizeof *offsets); UNIV_MEM_ASSERT_AND_ALLOC(offsets, n_alloc * sizeof *offsets);
offsets[0] = n_alloc; offsets[0] = n_alloc;
} }
......
...@@ -4202,7 +4202,7 @@ lock_rec_print( ...@@ -4202,7 +4202,7 @@ lock_rec_print(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_a(lock_get_type_low(lock) == LOCK_REC); ut_a(lock_get_type_low(lock) == LOCK_REC);
...@@ -4702,7 +4702,7 @@ lock_rec_validate_page( ...@@ -4702,7 +4702,7 @@ lock_rec_validate_page(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(!mutex_own(&kernel_mutex)); ut_ad(!mutex_own(&kernel_mutex));
...@@ -4962,7 +4962,7 @@ lock_rec_insert_check_and_lock( ...@@ -4962,7 +4962,7 @@ lock_rec_insert_check_and_lock(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
offsets = rec_get_offsets(next_rec, index, offsets_, offsets = rec_get_offsets(next_rec, index, offsets_,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
...@@ -5130,7 +5130,7 @@ lock_sec_rec_modify_check_and_lock( ...@@ -5130,7 +5130,7 @@ lock_sec_rec_modify_check_and_lock(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets_, offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
...@@ -5330,7 +5330,7 @@ lock_clust_rec_read_check_and_lock_alt( ...@@ -5330,7 +5330,7 @@ lock_clust_rec_read_check_and_lock_alt(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
ulint ret; ulint ret;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets, offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &tmp_heap); ULINT_UNDEFINED, &tmp_heap);
......
...@@ -62,7 +62,7 @@ page_cur_try_search_shortcut( ...@@ -62,7 +62,7 @@ page_cur_try_search_shortcut(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(dtuple_check_typed(tuple)); ut_ad(dtuple_check_typed(tuple));
...@@ -236,7 +236,7 @@ page_cur_search_with_match( ...@@ -236,7 +236,7 @@ page_cur_search_with_match(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(block && tuple && iup_matched_fields && iup_matched_bytes ut_ad(block && tuple && iup_matched_fields && iup_matched_bytes
&& ilow_matched_fields && ilow_matched_bytes && cursor); && ilow_matched_fields && ilow_matched_bytes && cursor);
...@@ -544,8 +544,8 @@ page_cur_insert_rec_write_log( ...@@ -544,8 +544,8 @@ page_cur_insert_rec_write_log(
ulint* cur_offs; ulint* cur_offs;
ulint* ins_offs; ulint* ins_offs;
*cur_offs_ = (sizeof cur_offs_) / sizeof *cur_offs_; rec_offs_init(cur_offs_);
*ins_offs_ = (sizeof ins_offs_) / sizeof *ins_offs_; rec_offs_init(ins_offs_);
cur_offs = rec_get_offsets(cursor_rec, index, cur_offs_, cur_offs = rec_get_offsets(cursor_rec, index, cur_offs_,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
...@@ -719,7 +719,7 @@ page_cur_parse_insert_rec( ...@@ -719,7 +719,7 @@ page_cur_parse_insert_rec(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
page = block ? buf_block_get_frame(block) : NULL; page = block ? buf_block_get_frame(block) : NULL;
...@@ -930,7 +930,7 @@ page_cur_insert_rec_low( ...@@ -930,7 +930,7 @@ page_cur_insert_rec_low(
ulint* foffsets = foffsets_; ulint* foffsets = foffsets_;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
*foffsets = sizeof(foffsets_) / sizeof *foffsets_; rec_offs_init(foffsets_);
foffsets = rec_get_offsets(free_rec, index, foffsets, foffsets = rec_get_offsets(free_rec, index, foffsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
...@@ -1200,7 +1200,7 @@ page_cur_insert_rec_zip( ...@@ -1200,7 +1200,7 @@ page_cur_insert_rec_zip(
ulint* foffsets = foffsets_; ulint* foffsets = foffsets_;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
*foffsets = sizeof(foffsets_) / sizeof *foffsets_; rec_offs_init(foffsets_);
foffsets = rec_get_offsets(free_rec, index, foffsets, foffsets = rec_get_offsets(free_rec, index, foffsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
...@@ -1465,7 +1465,7 @@ page_copy_rec_list_end_to_created_page( ...@@ -1465,7 +1465,7 @@ page_copy_rec_list_end_to_created_page(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW); ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW);
ut_ad(page_align(rec) != new_page); ut_ad(page_align(rec) != new_page);
...@@ -1675,7 +1675,7 @@ page_cur_parse_delete_rec( ...@@ -1675,7 +1675,7 @@ page_cur_parse_delete_rec(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* rec = page + offset; rec_t* rec = page + offset;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
page_cur_position(rec, block, &cursor); page_cur_position(rec, block, &cursor);
ut_ad(!buf_block_get_page_zip(block) || page_is_comp(page)); ut_ad(!buf_block_get_page_zip(block) || page_is_comp(page));
......
...@@ -514,7 +514,7 @@ page_copy_rec_list_end_no_locks( ...@@ -514,7 +514,7 @@ page_copy_rec_list_end_no_locks(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
page_cur_position(rec, block, &cur1); page_cur_position(rec, block, &cur1);
...@@ -681,7 +681,7 @@ page_copy_rec_list_start( ...@@ -681,7 +681,7 @@ page_copy_rec_list_start(
= page_rec_get_prev(page_get_supremum_rec(new_page)); = page_rec_get_prev(page_get_supremum_rec(new_page));
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
if (page_rec_is_infimum(rec)) { if (page_rec_is_infimum(rec)) {
...@@ -867,7 +867,7 @@ page_delete_rec_list_end( ...@@ -867,7 +867,7 @@ page_delete_rec_list_end(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE); ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE);
ut_ad(!page_zip || page_rec_is_comp(rec)); ut_ad(!page_zip || page_rec_is_comp(rec));
...@@ -1035,7 +1035,7 @@ page_delete_rec_list_start( ...@@ -1035,7 +1035,7 @@ page_delete_rec_list_start(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
byte type; byte type;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad((ibool) !!page_rec_is_comp(rec) ut_ad((ibool) !!page_rec_is_comp(rec)
== dict_table_is_comp(index->table)); == dict_table_is_comp(index->table));
...@@ -1593,7 +1593,7 @@ page_print_list( ...@@ -1593,7 +1593,7 @@ page_print_list(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table)); ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
......
...@@ -1183,7 +1183,7 @@ rec_convert_dtuple_to_rec( ...@@ -1183,7 +1183,7 @@ rec_convert_dtuple_to_rec(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets = rec_get_offsets(rec, index,
offsets_, ULINT_UNDEFINED, &heap); offsets_, ULINT_UNDEFINED, &heap);
...@@ -1213,7 +1213,7 @@ rec_copy_prefix_to_dtuple( ...@@ -1213,7 +1213,7 @@ rec_copy_prefix_to_dtuple(
ulint i; ulint i;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets, n_fields, &heap); offsets = rec_get_offsets(rec, index, offsets, n_fields, &heap);
...@@ -1664,7 +1664,7 @@ rec_print( ...@@ -1664,7 +1664,7 @@ rec_print(
} else { } else {
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
rec_print_new(file, rec, rec_print_new(file, rec,
rec_get_offsets(rec, index, offsets_, rec_get_offsets(rec, index, offsets_,
......
...@@ -1213,7 +1213,7 @@ row_ins_check_foreign_constraint( ...@@ -1213,7 +1213,7 @@ row_ins_check_foreign_constraint(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
run_again: run_again:
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -1661,7 +1661,7 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1661,7 +1661,7 @@ row_ins_scan_sec_index_for_duplicate(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
n_unique = dict_index_get_n_unique(index); n_unique = dict_index_get_n_unique(index);
...@@ -1800,7 +1800,7 @@ row_ins_duplicate_error_in_clust( ...@@ -1800,7 +1800,7 @@ row_ins_duplicate_error_in_clust(
mem_heap_t*heap = NULL; mem_heap_t*heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
UT_NOT_USED(mtr); UT_NOT_USED(mtr);
......
...@@ -411,7 +411,7 @@ row_merge_dup_report( ...@@ -411,7 +411,7 @@ row_merge_dup_report(
return; return;
} }
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
/* Convert the tuple to a record and then to MySQL format. */ /* Convert the tuple to a record and then to MySQL format. */
......
...@@ -3961,7 +3961,7 @@ row_scan_and_check_index( ...@@ -3961,7 +3961,7 @@ row_scan_and_check_index(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
*n_rows = 0; *n_rows = 0;
......
...@@ -102,7 +102,7 @@ row_purge_remove_clust_if_poss_low( ...@@ -102,7 +102,7 @@ row_purge_remove_clust_if_poss_low(
rec_t* rec; rec_t* rec;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
index = dict_table_get_first_index(node->table); index = dict_table_get_first_index(node->table);
......
...@@ -179,7 +179,7 @@ row_build( ...@@ -179,7 +179,7 @@ row_build(
ulint j; ulint j;
mem_heap_t* tmp_heap = NULL; mem_heap_t* tmp_heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(index && rec && heap); ut_ad(index && rec && heap);
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
...@@ -338,7 +338,7 @@ row_rec_to_index_entry( ...@@ -338,7 +338,7 @@ row_rec_to_index_entry(
mem_heap_t* tmp_heap = NULL; mem_heap_t* tmp_heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(rec && heap && index); ut_ad(rec && heap && index);
...@@ -403,7 +403,7 @@ row_build_row_ref( ...@@ -403,7 +403,7 @@ row_build_row_ref(
mem_heap_t* tmp_heap = NULL; mem_heap_t* tmp_heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(index && rec && heap); ut_ad(index && rec && heap);
...@@ -506,7 +506,7 @@ row_build_row_ref_in_tuple( ...@@ -506,7 +506,7 @@ row_build_row_ref_in_tuple(
ulint i; ulint i;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_a(ref); ut_a(ref);
ut_a(index); ut_a(index);
......
...@@ -119,8 +119,8 @@ row_sel_sec_rec_is_for_clust_rec( ...@@ -119,8 +119,8 @@ row_sel_sec_rec_is_for_clust_rec(
ulint* sec_offs = sec_offsets_; ulint* sec_offs = sec_offsets_;
ibool is_equal = TRUE; ibool is_equal = TRUE;
*clust_offsets_ = (sizeof clust_offsets_) / sizeof *clust_offsets_; rec_offs_init(clust_offsets_);
*sec_offsets_ = (sizeof sec_offsets_) / sizeof *sec_offsets_; rec_offs_init(sec_offsets_);
clust_offs = rec_get_offsets(clust_rec, clust_index, clust_offs, clust_offs = rec_get_offsets(clust_rec, clust_index, clust_offs,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
...@@ -753,7 +753,7 @@ row_sel_get_clust_rec( ...@@ -753,7 +753,7 @@ row_sel_get_clust_rec(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
*out_rec = NULL; *out_rec = NULL;
...@@ -1132,7 +1132,7 @@ row_sel_try_search_shortcut( ...@@ -1132,7 +1132,7 @@ row_sel_try_search_shortcut(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
ulint ret; ulint ret;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
index = plan->index; index = plan->index;
...@@ -1258,7 +1258,7 @@ row_sel( ...@@ -1258,7 +1258,7 @@ row_sel(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(thr->run_node == node); ut_ad(thr->run_node == node);
...@@ -3316,7 +3316,7 @@ row_search_for_mysql( ...@@ -3316,7 +3316,7 @@ row_search_for_mysql(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(index && pcur && search_tuple); ut_ad(index && pcur && search_tuple);
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
...@@ -4619,7 +4619,7 @@ row_search_autoinc_read_column( ...@@ -4619,7 +4619,7 @@ row_search_autoinc_read_column(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = sizeof offsets_ / sizeof *offsets_; rec_offs_init(offsets_);
/* TODO: We have to cast away the const of rec for now. This needs /* TODO: We have to cast away the const of rec for now. This needs
to be fixed later.*/ to be fixed later.*/
......
...@@ -155,7 +155,7 @@ row_undo_search_clust_to_pcur( ...@@ -155,7 +155,7 @@ row_undo_search_clust_to_pcur(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
mtr_start(&mtr); mtr_start(&mtr);
......
...@@ -708,7 +708,7 @@ row_upd_build_sec_rec_difference_binary( ...@@ -708,7 +708,7 @@ row_upd_build_sec_rec_difference_binary(
ulint i; ulint i;
ulint offsets_[REC_OFFS_SMALL_SIZE]; ulint offsets_[REC_OFFS_SMALL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
/* This function is used only for a secondary index */ /* This function is used only for a secondary index */
ut_a(!dict_index_is_clust(index)); ut_a(!dict_index_is_clust(index));
...@@ -780,7 +780,7 @@ row_upd_build_difference_binary( ...@@ -780,7 +780,7 @@ row_upd_build_difference_binary(
ulint i; ulint i;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
/* This function is used only for a clustered index */ /* This function is used only for a clustered index */
ut_a(dict_index_is_clust(index)); ut_a(dict_index_is_clust(index));
...@@ -1212,7 +1212,7 @@ row_upd_store_row( ...@@ -1212,7 +1212,7 @@ row_upd_store_row(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(node->pcur->latch_mode != BTR_NO_LATCHES); ut_ad(node->pcur->latch_mode != BTR_NO_LATCHES);
...@@ -1402,7 +1402,7 @@ row_upd_clust_rec_by_insert( ...@@ -1402,7 +1402,7 @@ row_upd_clust_rec_by_insert(
rec_t* rec; rec_t* rec;
dict_index_t* index; dict_index_t* index;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG, err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
btr_cur, TRUE, thr, mtr); btr_cur, TRUE, thr, mtr);
...@@ -1551,7 +1551,7 @@ row_upd_clust_rec( ...@@ -1551,7 +1551,7 @@ row_upd_clust_rec(
if (err == DB_SUCCESS && big_rec) { if (err == DB_SUCCESS && big_rec) {
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* rec; rec_t* rec;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
mtr_start(mtr); mtr_start(mtr);
...@@ -1653,7 +1653,7 @@ row_upd_clust_step( ...@@ -1653,7 +1653,7 @@ row_upd_clust_step(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets; const ulint* offsets;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
index = dict_table_get_first_index(node->table); index = dict_table_get_first_index(node->table);
...@@ -2007,7 +2007,7 @@ row_upd_in_place_in_select( ...@@ -2007,7 +2007,7 @@ row_upd_in_place_in_select(
ulint err; ulint err;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_ad(sel_node->select_will_do_update); ut_ad(sel_node->select_will_do_update);
ut_ad(sel_node->latch_mode == BTR_MODIFY_LEAF); ut_ad(sel_node->latch_mode == BTR_MODIFY_LEAF);
......
...@@ -1013,7 +1013,7 @@ trx_undo_report_row_operation( ...@@ -1013,7 +1013,7 @@ trx_undo_report_row_operation(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; rec_offs_init(offsets_);
ut_a(dict_index_is_clust(index)); ut_a(dict_index_is_clust(index));
......
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