Commit 5983048f authored by marko's avatar marko

branches/zip: Minor cleanup.

btr_search_drop_page_hash_index(): Add const qualifiers to the local
variables page, rec, and index, to ensure that they are not modified
by this function.

page_get_infimum_offset(), page_get_supremum_offset(): New functions.

page_get_infimum_rec(), page_get_supremum_rec(): Replaced by
const-preserving macros that invoke the accessor functions.
parent 855c2aa8
......@@ -971,21 +971,21 @@ btr_search_drop_page_hash_index(
for which we know that
block->buf_fix_count == 0 */
{
hash_table_t* table;
ulint n_fields;
ulint n_bytes;
page_t* page;
rec_t* rec;
ulint fold;
ulint prev_fold;
dulint index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
ulint i;
mem_heap_t* heap;
dict_index_t* index;
ulint* offsets;
hash_table_t* table;
ulint n_fields;
ulint n_bytes;
const page_t* page;
const rec_t* rec;
ulint fold;
ulint prev_fold;
dulint index_id;
ulint n_cached;
ulint n_recs;
ulint* folds;
ulint i;
mem_heap_t* heap;
const dict_index_t* index;
ulint* offsets;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
......@@ -1034,7 +1034,7 @@ retry:
n_cached = 0;
rec = page_get_infimum_rec(page);
rec = page_rec_get_next(rec);
rec = page_rec_get_next_low(rec, page_is_comp(page));
index_id = btr_page_get_index_id(page);
......@@ -1062,7 +1062,7 @@ retry:
folds[n_cached] = fold;
n_cached++;
next_rec:
rec = page_rec_get_next(rec);
rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
prev_fold = fold;
}
......
......@@ -244,21 +244,25 @@ page_header_reset_last_insert(
uncompressed part will be updated, or NULL */
mtr_t* mtr); /* in: mtr */
/****************************************************************
Gets the first record on the page. */
Gets the offset of the first record on the page. */
UNIV_INLINE
rec_t*
page_get_infimum_rec(
/*=================*/
/* out: the first record in record list */
page_t* page); /* in: page which must have record(s) */
ulint
page_get_infimum_offset(
/*====================*/
/* out: offset of the first record
in record list, relative from page */
const page_t* page); /* in: page which must have record(s) */
/****************************************************************
Gets the last record on the page. */
Gets the offset of the last record on the page. */
UNIV_INLINE
rec_t*
page_get_supremum_rec(
/*==================*/
/* out: the last record in record list */
page_t* page); /* in: page which must have record(s) */
ulint
page_get_supremum_offset(
/*=====================*/
/* out: offset of the last record in
record list, relative from page */
const page_t* page); /* in: page which must have record(s) */
#define page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page))
#define page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page))
/****************************************************************
Returns the middle record of record list. If there are an even number
of records in the list, returns the first record of upper half-list. */
......
......@@ -246,38 +246,42 @@ page_is_leaf(
}
/****************************************************************
Gets the first record on the page. */
Gets the offset of the first record on the page. */
UNIV_INLINE
rec_t*
page_get_infimum_rec(
/*=================*/
/* out: the first record in record list */
page_t* page) /* in: page which must have record(s) */
ulint
page_get_infimum_offset(
/*====================*/
/* out: offset of the first record
in record list, relative from page */
const page_t* page) /* in: page which must have record(s) */
{
ut_ad(page);
ut_ad(!page_offset(page));
if (page_is_comp(page)) {
return(page + PAGE_NEW_INFIMUM);
return(PAGE_NEW_INFIMUM);
} else {
return(page + PAGE_OLD_INFIMUM);
return(PAGE_OLD_INFIMUM);
}
}
/****************************************************************
Gets the last record on the page. */
Gets the offset of the last record on the page. */
UNIV_INLINE
rec_t*
page_get_supremum_rec(
/*==================*/
/* out: the last record in record list */
page_t* page) /* in: page which must have record(s) */
ulint
page_get_supremum_offset(
/*=====================*/
/* out: offset of the last record in
record list, relative from page */
const page_t* page) /* in: page which must have record(s) */
{
ut_ad(page);
ut_ad(!page_offset(page));
if (page_is_comp(page)) {
return(page + PAGE_NEW_SUPREMUM);
return(PAGE_NEW_SUPREMUM);
} else {
return(page + PAGE_OLD_SUPREMUM);
return(PAGE_OLD_SUPREMUM);
}
}
......
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