Commit 7e687905 authored by marko's avatar marko

branches/zip: Add some const qualifiers, mainly to upd_t*.

upd_get_n_fields(), upd_get_nth_field(): Add const qualifiers.
parent f24fa9e6
......@@ -106,7 +106,7 @@ btr_rec_free_updated_extern_fields(
page_zip_des_t* page_zip,/* in: compressed page whose uncompressed
part will be updated, or NULL */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
mtr_t* mtr); /* in: mini-transaction handle which contains
an X-latch to record page and to the tree */
/***************************************************************
......@@ -1468,7 +1468,7 @@ btr_cur_upd_lock_and_undo(
number */
ulint flags, /* in: undo logging and locking flags */
btr_cur_t* cursor, /* in: cursor on record to update */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
ulint cmpl_info,/* in: compiler info on secondary index
updates */
que_thr_t* thr, /* in: query thread */
......@@ -1531,7 +1531,7 @@ btr_cur_update_in_place_log(
ulint flags, /* in: flags */
rec_t* rec, /* in: record */
dict_index_t* index, /* in: index where cursor positioned */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
trx_t* trx, /* in: transaction */
dulint roll_ptr, /* in: roll ptr */
mtr_t* mtr) /* in: mtr */
......@@ -1717,7 +1717,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /* in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
ulint cmpl_info,/* in: compiler info on secondary index
updates */
que_thr_t* thr, /* in: query thread */
......@@ -1844,7 +1844,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /* in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
upd_t* update, /* in: update vector; this must also
const upd_t* update, /* in: update vector; this must also
contain trx id and roll ptr fields */
ulint cmpl_info,/* in: compiler info on secondary index
updates */
......@@ -3513,7 +3513,7 @@ btr_cur_mark_dtuple_inherited_extern(
const ulint* ext_vec, /* in: array of extern fields in the
original record */
ulint n_ext_vec, /* in: number of elements in ext_vec */
upd_t* update) /* in: update vector */
const upd_t* update) /* in: update vector */
{
dfield_t* dfield;
ulint byte_val;
......@@ -3636,7 +3636,7 @@ btr_push_update_extern_fields(
to have twice the space for all fields
in rec */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
upd_t* update) /* in: update vector or NULL */
const upd_t* update) /* in: update vector or NULL */
{
ulint n_pushed = 0;
ulint n;
......@@ -4340,13 +4340,12 @@ btr_rec_free_updated_extern_fields(
page_zip_des_t* page_zip,/* in: compressed page whose uncompressed
part will be updated, or NULL */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
mtr_t* mtr) /* in: mini-transaction handle which contains
an X-latch to record page and to the tree */
{
upd_field_t* ufield;
ulint n_fields;
ulint i;
ulint n_fields;
ulint i;
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX));
......@@ -4356,7 +4355,7 @@ btr_rec_free_updated_extern_fields(
n_fields = upd_get_n_fields(update);
for (i = 0; i < n_fields; i++) {
ufield = upd_get_nth_field(update, i);
const upd_field_t* ufield = upd_get_nth_field(update, i);
if (rec_offs_nth_extern(offsets, ufield->field_no)) {
ulint len;
......
......@@ -224,7 +224,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /* in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
ulint cmpl_info,/* in: compiler info on secondary index
updates */
que_thr_t* thr, /* in: query thread */
......@@ -248,7 +248,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /* in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
upd_t* update, /* in: update vector; this must also
const upd_t* update, /* in: update vector; this must also
contain trx id and roll ptr fields */
ulint cmpl_info,/* in: compiler info on secondary index
updates */
......@@ -461,7 +461,7 @@ btr_cur_mark_dtuple_inherited_extern(
const ulint* ext_vec, /* in: array of extern fields in the
original record */
ulint n_ext_vec, /* in: number of elements in ext_vec */
upd_t* update); /* in: update vector */
const upd_t* update); /* in: update vector */
/***********************************************************************
Marks all extern fields in a dtuple as owned by the record. */
......@@ -573,8 +573,7 @@ btr_push_update_extern_fields(
to have twice the space for all fields
in rec */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
upd_t* update);/* in: update vector or NULL */
const upd_t* update);/* in: update vector or NULL */
/*######################################################################*/
......
......@@ -35,17 +35,21 @@ UNIV_INLINE
ulint
upd_get_n_fields(
/*=============*/
/* out: number of fields */
upd_t* update); /* in: update vector */
/* out: number of fields */
const upd_t* update); /* in: update vector */
#ifdef UNIV_DEBUG
/*************************************************************************
Returns the nth field of an update vector. */
UNIV_INLINE
upd_field_t*
upd_get_nth_field(
/*==============*/
/* out: update vector field */
upd_t* update, /* in: update vector */
ulint n); /* in: field position in update vector */
/* out: update vector field */
const upd_t* update, /* in: update vector */
ulint n); /* in: field position in update vector */
#else
# define upd_get_nth_field(update, n) ((update)->fields + (n))
#endif
/*************************************************************************
Sets an index field number to be updated by an update vector field. */
UNIV_INLINE
......@@ -112,11 +116,12 @@ Writes to the redo log the new values of the fields occurring in the index. */
void
row_upd_index_write_log(
/*====================*/
upd_t* update, /* in: update vector */
byte* log_ptr,/* in: pointer to mlog buffer: must contain at least
MLOG_BUF_MARGIN bytes of free space; the buffer is
closed within this function */
mtr_t* mtr); /* in: mtr into whose log to write */
const upd_t* update, /* in: update vector */
byte* log_ptr,/* in: pointer to mlog buffer: must
contain at least MLOG_BUF_MARGIN bytes
of free space; the buffer is closed
within this function */
mtr_t* mtr); /* in: mtr into whose log to write */
/***************************************************************
Returns TRUE if row update changes size of some field in index or if some
field to be updated is stored externally in rec or update. */
......@@ -129,7 +134,7 @@ row_upd_changes_field_size_or_external(
in rec or update */
dict_index_t* index, /* in: index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
upd_t* update);/* in: update vector */
const upd_t* update);/* in: update vector */
/***************************************************************
Replaces the new column values stored in the update vector to the record
given. No field size changes are allowed. */
......@@ -140,7 +145,7 @@ row_upd_rec_in_place(
rec_t* rec, /* in/out: record where replaced */
dict_index_t* index, /* in: the index the record belongs to */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
page_zip_des_t* page_zip);/* in: compressed page with enough space
available, or NULL */
/*******************************************************************
......@@ -173,7 +178,7 @@ row_upd_build_difference_binary(
const ulint* ext_vec,/* in: array containing field numbers of
externally stored fields in entry, or NULL */
ulint n_ext_vec,/* in: number of fields in ext_vec */
rec_t* rec, /* in: clustered index record */
const rec_t* rec, /* in: clustered index record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap); /* in: memory heap from which allocated */
/***************************************************************
......@@ -186,7 +191,7 @@ row_upd_index_replace_new_col_vals_index_pos(
dtuple_t* entry, /* in/out: index entry where replaced */
dict_index_t* index, /* in: index; NOTE that this may also be a
non-clustered index */
upd_t* update, /* in: an update vector built for the index so
const upd_t* update, /* in: an update vector built for the index so
that the field number in an upd_field is the
index position */
ibool order_only,
......@@ -225,12 +230,12 @@ row_upd_changes_ord_field_binary(
an ordering field in the index record;
NOTE: the fields are compared as binary
strings */
dtuple_t* row, /* in: old value of row, or NULL if the
const dtuple_t* row, /* in: old value of row, or NULL if the
row and the data values in update are not
known when this function is called, e.g., at
compile time */
dict_index_t* index, /* in: index of the record */
upd_t* update);/* in: update vector for the row; NOTE: the
const upd_t* update);/* in: update vector for the row; NOTE: the
field numbers in this MUST be clustered index
positions! */
/***************************************************************
......
......@@ -46,29 +46,31 @@ UNIV_INLINE
ulint
upd_get_n_fields(
/*=============*/
/* out: number of fields */
upd_t* update) /* in: update vector */
/* out: number of fields */
const upd_t* update) /* in: update vector */
{
ut_ad(update);
return(update->n_fields);
}
#ifdef UNIV_DEBUG
/*************************************************************************
Returns the nth field of an update vector. */
UNIV_INLINE
upd_field_t*
upd_get_nth_field(
/*==============*/
/* out: update vector field */
upd_t* update, /* in: update vector */
ulint n) /* in: field position in update vector */
/* out: update vector field */
const upd_t* update, /* in: update vector */
ulint n) /* in: field position in update vector */
{
ut_ad(update);
ut_ad(n < update->n_fields);
return(update->fields + n);
return((upd_field_t*) update->fields + n);
}
#endif /* UNIV_DEBUG */
/*************************************************************************
Sets an index field number to be updated by an update vector field. */
......
......@@ -201,7 +201,7 @@ trx_undo_report_row_operation(
const dtuple_t* clust_entry, /* in: in the case of an insert,
index entry to insert into the
clustered index, otherwise NULL */
upd_t* update, /* in: in the case of an update,
const upd_t* update, /* in: in the case of an update,
the update vector, otherwise NULL */
ulint cmpl_info, /* in: compiler info on secondary
index updates */
......
......@@ -376,14 +376,14 @@ row_upd_changes_field_size_or_external(
in rec or update */
dict_index_t* index, /* in: index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
upd_t* update) /* in: update vector */
const upd_t* update) /* in: update vector */
{
upd_field_t* upd_field;
dfield_t* new_val;
ulint old_len;
ulint new_len;
ulint n_fields;
ulint i;
const upd_field_t* upd_field;
const dfield_t* new_val;
ulint old_len;
ulint new_len;
ulint n_fields;
ulint i;
ut_ad(rec_offs_validate(NULL, index, offsets));
n_fields = upd_get_n_fields(update);
......@@ -449,14 +449,14 @@ row_upd_rec_in_place(
rec_t* rec, /* in/out: record where replaced */
dict_index_t* index, /* in: the index the record belongs to */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
upd_t* update, /* in: update vector */
const upd_t* update, /* in: update vector */
page_zip_des_t* page_zip)/* in: compressed page with enough space
available, or NULL */
{
upd_field_t* upd_field;
dfield_t* new_val;
ulint n_fields;
ulint i;
const upd_field_t* upd_field;
const dfield_t* new_val;
ulint n_fields;
ulint i;
ut_ad(rec_offs_validate(rec, index, offsets));
......@@ -551,18 +551,19 @@ Writes to the redo log the new values of the fields occurring in the index. */
void
row_upd_index_write_log(
/*====================*/
upd_t* update, /* in: update vector */
byte* log_ptr,/* in: pointer to mlog buffer: must contain at least
MLOG_BUF_MARGIN bytes of free space; the buffer is
closed within this function */
mtr_t* mtr) /* in: mtr into whose log to write */
const upd_t* update, /* in: update vector */
byte* log_ptr,/* in: pointer to mlog buffer: must
contain at least MLOG_BUF_MARGIN bytes
of free space; the buffer is closed
within this function */
mtr_t* mtr) /* in: mtr into whose log to write */
{
upd_field_t* upd_field;
dfield_t* new_val;
ulint len;
ulint n_fields;
byte* buf_end;
ulint i;
const upd_field_t* upd_field;
const dfield_t* new_val;
ulint len;
ulint n_fields;
byte* buf_end;
ulint i;
n_fields = upd_get_n_fields(update);
......@@ -808,7 +809,7 @@ row_upd_build_difference_binary(
const ulint* ext_vec,/* in: array containing field numbers of
externally stored fields in entry, or NULL */
ulint n_ext_vec,/* in: number of fields in ext_vec */
rec_t* rec, /* in: clustered index record */
const rec_t* rec, /* in: clustered index record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap) /* in: memory heap from which allocated */
{
......@@ -888,7 +889,7 @@ row_upd_index_replace_new_col_vals_index_pos(
dtuple_t* entry, /* in/out: index entry where replaced */
dict_index_t* index, /* in: index; NOTE that this may also be a
non-clustered index */
upd_t* update, /* in: an update vector built for the index so
const upd_t* update, /* in: an update vector built for the index so
that the field number in an upd_field is the
index position */
ibool order_only,
......@@ -1049,12 +1050,12 @@ row_upd_changes_ord_field_binary(
an ordering field in the index record;
NOTE: the fields are compared as binary
strings */
dtuple_t* row, /* in: old value of row, or NULL if the
const dtuple_t* row, /* in: old value of row, or NULL if the
row and the data values in update are not
known when this function is called, e.g., at
compile time */
dict_index_t* index, /* in: index of the record */
upd_t* update) /* in: update vector for the row; NOTE: the
const upd_t* update) /* in: update vector for the row; NOTE: the
field numbers in this MUST be clustered index
positions! */
{
......@@ -1084,7 +1085,7 @@ row_upd_changes_ord_field_binary(
for (j = 0; j < n_upd_fields; j++) {
upd_field_t* upd_field
const upd_field_t* upd_field
= upd_get_nth_field(update, j);
/* Note that if the index field is a column prefix
......
......@@ -650,7 +650,7 @@ trx_undo_page_report_modify(
const rec_t* rec, /* in: clustered index record which
has NOT yet been modified */
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
upd_t* update, /* in: update vector which tells the
const upd_t* update, /* in: update vector which tells the
columns to be updated; in the case of
a delete, this should be set to NULL */
ulint cmpl_info, /* in: compiler info on secondary
......@@ -1223,7 +1223,7 @@ trx_undo_report_row_operation(
const dtuple_t* clust_entry, /* in: in the case of an insert,
index entry to insert into the
clustered index, otherwise NULL */
upd_t* update, /* in: in the case of an update,
const upd_t* update, /* in: in the case of an update,
the update vector, otherwise NULL */
ulint cmpl_info, /* in: compiler info on secondary
index updates */
......
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