Commit 94c77111 authored by marko's avatar marko

branches/zip: Add const qualifiers to some read-only byte* and rec_t*

parameters of some functions.
parent f1348098
......@@ -28,7 +28,7 @@ ulint
row_get_trx_id_offset(
/*==================*/
/* out: offset of DATA_TRX_ID */
rec_t* rec, /* in: record */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/*************************************************************************
......@@ -38,7 +38,7 @@ dulint
row_get_rec_trx_id(
/*===============*/
/* out: value of the field */
rec_t* rec, /* in: record */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/*************************************************************************
......@@ -48,7 +48,7 @@ dulint
row_get_rec_roll_ptr(
/*=================*/
/* out: value of the field */
rec_t* rec, /* in: record */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/*********************************************************************
......@@ -80,7 +80,7 @@ row_build(
data fields on the index page, and thus is
more efficient */
dict_index_t* index, /* in: clustered index */
rec_t* rec, /* in: record in the clustered index;
const rec_t* rec, /* in: record in the clustered index;
NOTE: in the case ROW_COPY_POINTERS
the data fields in the row will point
directly into this record, therefore,
......@@ -107,7 +107,7 @@ row_rec_to_index_entry(
heap as the latter only places pointers to
data fields on the index page */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index;
NOTE: in the case ROW_COPY_POINTERS
the data fields in the row will point
directly into this record, therefore,
......@@ -130,7 +130,7 @@ row_build_row_ref(
heap, whereas the latter only places pointers
to data fields on the index page */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index;
NOTE: in the case ROW_COPY_POINTERS
the data fields in the row will point
directly into this record, therefore,
......@@ -149,7 +149,7 @@ row_build_row_ref_in_tuple(
dtuple_t* ref, /* in/out: row reference built; see the
NOTE below! */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index;
NOTE: the data fields in ref will point
directly into this record, therefore,
the buffer page of this record must be
......@@ -182,7 +182,7 @@ row_build_row_ref_fast(
const ulint* map, /* in: array of field numbers in rec
telling how ref should be built from
the fields of rec */
rec_t* rec, /* in: record in the index; must be
const rec_t* rec, /* in: record in the index; must be
preserved while ref is used, as we do
not copy field values to heap */
const ulint* offsets);/* in: array returned by rec_get_offsets() */
......@@ -209,7 +209,7 @@ row_get_clust_rec(
/*==============*/
/* out: record or NULL, if no record found */
ulint mode, /* in: BTR_MODIFY_LEAF, ... */
rec_t* rec, /* in: record in a secondary index */
const rec_t* rec, /* in: record in a secondary index */
dict_index_t* index, /* in: secondary index */
dict_index_t** clust_index,/* out: clustered index */
mtr_t* mtr); /* in: mtr */
......@@ -221,7 +221,7 @@ row_search_index_entry(
/*===================*/
/* out: TRUE if found */
dict_index_t* index, /* in: index */
dtuple_t* entry, /* in: index entry */
const dtuple_t* entry, /* in: index entry */
ulint mode, /* in: BTR_MODIFY_LEAF, ... */
btr_pcur_t* pcur, /* in/out: persistent cursor, which must
be closed by the caller */
......
......@@ -17,7 +17,7 @@ dulint
row_get_rec_trx_id(
/*===============*/
/* out: value of the field */
rec_t* rec, /* in: record */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{
......@@ -42,7 +42,7 @@ dulint
row_get_rec_roll_ptr(
/*=================*/
/* out: value of the field */
rec_t* rec, /* in: record */
const rec_t* rec, /* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{
......@@ -72,13 +72,13 @@ row_build_row_ref_fast(
const ulint* map, /* in: array of field numbers in rec
telling how ref should be built from
the fields of rec */
rec_t* rec, /* in: record in the index; must be
const rec_t* rec, /* in: record in the index; must be
preserved while ref is used, as we do
not copy field values to heap */
const ulint* offsets)/* in: array returned by rec_get_offsets() */
{
dfield_t* dfield;
byte* field;
const byte* field;
ulint len;
ulint ref_len;
ulint field_no;
......
......@@ -221,8 +221,8 @@ UNIV_INLINE
dulint
trx_read_trx_id(
/*============*/
/* out: id */
byte* ptr); /* in: pointer to memory from where to read */
/* out: id */
const byte* ptr); /* in: pointer to memory from where to read */
/********************************************************************
Looks for the trx handle with the given id in trx_list. */
UNIV_INLINE
......@@ -287,8 +287,9 @@ magic number shows it valid. */
void
trx_sys_print_mysql_binlog_offset_from_page(
/*========================================*/
byte* page); /* in: buffer containing the trx system header page,
i.e., page number TRX_SYS_PAGE_NO in the tablespace */
const byte* page); /* in: buffer containing the trx
system header page, i.e., page number
TRX_SYS_PAGE_NO in the tablespace */
#endif /* UNIV_HOTBACKUP */
/*********************************************************************
Prints to stderr the MySQL master log offset info in the trx system header if
......
......@@ -232,8 +232,8 @@ UNIV_INLINE
dulint
trx_read_trx_id(
/*============*/
/* out: id */
byte* ptr) /* in: pointer to memory from where to read */
/* out: id */
const byte* ptr) /* in: pointer to memory from where to read */
{
#if DATA_TRX_ID_LEN != 6
# error "DATA_TRX_ID_LEN != 6"
......
......@@ -64,8 +64,8 @@ UNIV_INLINE
dulint
trx_read_roll_ptr(
/*==============*/
/* out: roll ptr */
byte* ptr); /* in: pointer to memory from where to read */
/* out: roll ptr */
const byte* ptr); /* in: pointer to memory from where to read */
/**********************************************************************
Gets an undo log page and x-latches it. */
UNIV_INLINE
......
......@@ -111,8 +111,8 @@ UNIV_INLINE
dulint
trx_read_roll_ptr(
/*==============*/
/* out: roll ptr */
byte* ptr) /* in: pointer to memory from where to read */
/* out: roll ptr */
const byte* ptr) /* in: pointer to memory from where to read */
{
#if DATA_ROLL_PTR_LEN != 7
# error "DATA_ROLL_PTR_LEN != 7"
......
......@@ -35,12 +35,13 @@ ulint
row_get_trx_id_offset(
/*==================*/
/* out: offset of DATA_TRX_ID */
rec_t* rec, /* in: record */
const rec_t* rec __attribute__((unused)),
/* in: record */
dict_index_t* index, /* in: clustered index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{
ulint pos;
byte* field;
ulint offset;
ulint len;
ut_ad(dict_index_is_clust(index));
......@@ -48,11 +49,11 @@ row_get_trx_id_offset(
pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
field = rec_get_nth_field(rec, offsets, pos, &len);
offset = rec_get_nth_field_offs(offsets, pos, &len);
ut_ad(len == DATA_TRX_ID_LEN);
return(field - rec);
return(offset);
}
/*********************************************************************
......@@ -160,7 +161,7 @@ row_build(
data fields on the index page, and thus is
more efficient */
dict_index_t* index, /* in: clustered index */
rec_t* rec, /* in: record in the clustered index;
const rec_t* rec, /* in: record in the clustered index;
NOTE: in the case ROW_COPY_POINTERS
the data fields in the row will point
directly into this record, therefore,
......@@ -233,7 +234,7 @@ row_build(
dfield_t* dfield = dtuple_get_nth_field(
row, dict_col_get_no(col));
byte* field = rec_get_nth_field(
const byte* field = rec_get_nth_field(
rec, offsets, i, &len);
dfield_set_data(dfield, field, len);
......@@ -276,7 +277,7 @@ row_rec_to_index_entry(
heap as the latter only places pointers to
data fields on the index page */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index;
NOTE: in the case ROW_COPY_POINTERS
the data fields in the row will point
directly into this record, therefore,
......@@ -289,7 +290,7 @@ row_rec_to_index_entry(
dtuple_t* entry;
dfield_t* dfield;
ulint i;
byte* field;
const byte* field;
ulint len;
ulint rec_len;
byte* buf;
......@@ -354,7 +355,7 @@ row_build_row_ref(
heap, whereas the latter only places pointers
to data fields on the index page */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index;
NOTE: in the case ROW_COPY_POINTERS
the data fields in the row will point
directly into this record, therefore,
......@@ -368,7 +369,7 @@ row_build_row_ref(
dict_index_t* clust_index;
dfield_t* dfield;
dtuple_t* ref;
byte* field;
const byte* field;
ulint len;
ulint ref_len;
ulint pos;
......@@ -459,7 +460,7 @@ row_build_row_ref_in_tuple(
dtuple_t* ref, /* in/out: row reference built; see the
NOTE below! */
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in the index;
const rec_t* rec, /* in: record in the index;
NOTE: the data fields in ref will point
directly into this record, therefore,
the buffer page of this record must be
......@@ -469,7 +470,7 @@ row_build_row_ref_in_tuple(
{
dict_index_t* clust_index;
dfield_t* dfield;
byte* field;
const byte* field;
ulint len;
ulint ref_len;
ulint pos;
......@@ -656,7 +657,7 @@ row_get_clust_rec(
/*==============*/
/* out: record or NULL, if no record found */
ulint mode, /* in: BTR_MODIFY_LEAF, ... */
rec_t* rec, /* in: record in a secondary index */
const rec_t* rec, /* in: record in a secondary index */
dict_index_t* index, /* in: secondary index */
dict_index_t** clust_index,/* out: clustered index */
mtr_t* mtr) /* in: mtr */
......@@ -697,7 +698,7 @@ row_search_index_entry(
/*===================*/
/* out: TRUE if found */
dict_index_t* index, /* in: index */
dtuple_t* entry, /* in: index entry */
const dtuple_t* entry, /* in: index entry */
ulint mode, /* in: BTR_MODIFY_LEAF, ... */
btr_pcur_t* pcur, /* in/out: persistent cursor, which must
be closed by the caller */
......
......@@ -665,10 +665,11 @@ magic number shows it valid. */
void
trx_sys_print_mysql_binlog_offset_from_page(
/*========================================*/
byte* page) /* in: buffer containing the trx system header page,
i.e., page number TRX_SYS_PAGE_NO in the tablespace */
const byte* page) /* in: buffer containing the trx
system header page, i.e., page number
TRX_SYS_PAGE_NO in the tablespace */
{
trx_sysf_t* sys_header;
const trx_sysf_t* sys_header;
sys_header = page + TRX_SYS;
......
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