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
...@@ -974,8 +974,8 @@ btr_search_drop_page_hash_index( ...@@ -974,8 +974,8 @@ btr_search_drop_page_hash_index(
hash_table_t* table; hash_table_t* table;
ulint n_fields; ulint n_fields;
ulint n_bytes; ulint n_bytes;
page_t* page; const page_t* page;
rec_t* rec; const rec_t* rec;
ulint fold; ulint fold;
ulint prev_fold; ulint prev_fold;
dulint index_id; dulint index_id;
...@@ -984,7 +984,7 @@ btr_search_drop_page_hash_index( ...@@ -984,7 +984,7 @@ btr_search_drop_page_hash_index(
ulint* folds; ulint* folds;
ulint i; ulint i;
mem_heap_t* heap; mem_heap_t* heap;
dict_index_t* index; const dict_index_t* index;
ulint* offsets; ulint* offsets;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -1034,7 +1034,7 @@ retry: ...@@ -1034,7 +1034,7 @@ retry:
n_cached = 0; n_cached = 0;
rec = page_get_infimum_rec(page); 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); index_id = btr_page_get_index_id(page);
...@@ -1062,7 +1062,7 @@ retry: ...@@ -1062,7 +1062,7 @@ retry:
folds[n_cached] = fold; folds[n_cached] = fold;
n_cached++; n_cached++;
next_rec: next_rec:
rec = page_rec_get_next(rec); rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
prev_fold = fold; prev_fold = fold;
} }
......
...@@ -244,21 +244,25 @@ page_header_reset_last_insert( ...@@ -244,21 +244,25 @@ page_header_reset_last_insert(
uncompressed part will be updated, or NULL */ uncompressed part will be updated, or NULL */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/**************************************************************** /****************************************************************
Gets the first record on the page. */ Gets the offset of the first record on the page. */
UNIV_INLINE UNIV_INLINE
rec_t* ulint
page_get_infimum_rec( page_get_infimum_offset(
/*=================*/ /*====================*/
/* out: the first record in record list */ /* out: offset of the first record
page_t* page); /* in: page which must have record(s) */ 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 UNIV_INLINE
rec_t* ulint
page_get_supremum_rec( page_get_supremum_offset(
/*==================*/ /*=====================*/
/* out: the last record in record list */ /* out: offset of the last record in
page_t* page); /* in: page which must have record(s) */ 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 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. */ of records in the list, returns the first record of upper half-list. */
......
...@@ -246,38 +246,42 @@ page_is_leaf( ...@@ -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 UNIV_INLINE
rec_t* ulint
page_get_infimum_rec( page_get_infimum_offset(
/*=================*/ /*====================*/
/* out: the first record in record list */ /* out: offset of the first record
page_t* page) /* in: page which must have record(s) */ in record list, relative from page */
const page_t* page) /* in: page which must have record(s) */
{ {
ut_ad(page); ut_ad(page);
ut_ad(!page_offset(page));
if (page_is_comp(page)) { if (page_is_comp(page)) {
return(page + PAGE_NEW_INFIMUM); return(PAGE_NEW_INFIMUM);
} else { } 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 UNIV_INLINE
rec_t* ulint
page_get_supremum_rec( page_get_supremum_offset(
/*==================*/ /*=====================*/
/* out: the last record in record list */ /* out: offset of the last record in
page_t* page) /* in: page which must have record(s) */ record list, relative from page */
const page_t* page) /* in: page which must have record(s) */
{ {
ut_ad(page); ut_ad(page);
ut_ad(!page_offset(page));
if (page_is_comp(page)) { if (page_is_comp(page)) {
return(page + PAGE_NEW_SUPREMUM); return(PAGE_NEW_SUPREMUM);
} else { } 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