Commit 5a6b9cf2 authored by marko's avatar marko

branches/innodb+: Minor cleanup.

ibuf_rec_get_info(): Eliminate the local variable "mod".  Use switch-case
instead of if-else if-else.

ibuf_rec_get_op_type(), ibuf_add_ops(), ibuf_print_ops():
Add const qualifiers to read-only parameters.

ibuf_rec_get_volume(): Remove empty line at end of block.
parent 6947f4a9
...@@ -1132,7 +1132,6 @@ ibuf_rec_get_info( ...@@ -1132,7 +1132,6 @@ ibuf_rec_get_info(
const byte* types; const byte* types;
ulint fields; ulint fields;
ulint len; ulint len;
ulint mod;
/* Local variables to shadow arguments. */ /* Local variables to shadow arguments. */
ibuf_op_t op_local; ibuf_op_t op_local;
...@@ -1146,28 +1145,25 @@ ibuf_rec_get_info( ...@@ -1146,28 +1145,25 @@ ibuf_rec_get_info(
types = rec_get_nth_field_old(rec, 3, &len); types = rec_get_nth_field_old(rec, 3, &len);
mod = len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE; info_len_local = len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE;
if (mod == 0) { switch (info_len_local) {
case 0:
case 1:
op_local = IBUF_OP_INSERT; op_local = IBUF_OP_INSERT;
comp_local = FALSE; comp_local = info_len_local;
info_len_local = 0;
ut_ad(!counter); ut_ad(!counter);
counter_local = ULINT_UNDEFINED;
break;
} else if (mod == 1) { case IBUF_REC_INFO_SIZE:
op_local = IBUF_OP_INSERT;
comp_local = TRUE;
info_len_local = 1;
ut_ad(!counter);
} else if (mod == IBUF_REC_INFO_SIZE) {
op_local = (ibuf_op_t)types[IBUF_REC_OFFSET_TYPE]; op_local = (ibuf_op_t)types[IBUF_REC_OFFSET_TYPE];
comp_local = types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT; comp_local = types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT;
info_len_local = IBUF_REC_INFO_SIZE;
counter_local = mach_read_from_2( counter_local = mach_read_from_2(
types + IBUF_REC_OFFSET_COUNTER); types + IBUF_REC_OFFSET_COUNTER);
break;
} else { default:
ut_error; ut_error;
} }
...@@ -1198,8 +1194,8 @@ static ...@@ -1198,8 +1194,8 @@ static
ibuf_op_t ibuf_op_t
ibuf_rec_get_op_type( ibuf_rec_get_op_type(
/*=================*/ /*=================*/
/* out: operation type */ /* out: operation type */
rec_t* rec) /* in: ibuf record */ const rec_t* rec) /* in: ibuf record */
{ {
ulint len; ulint len;
const byte* field; const byte* field;
...@@ -1260,8 +1256,8 @@ static ...@@ -1260,8 +1256,8 @@ static
void void
ibuf_add_ops( ibuf_add_ops(
/*=========*/ /*=========*/
ulint* arr, /* in/out: array to modify */ ulint* arr, /* in/out: array to modify */
ulint* ops) /* in: operation counts */ const ulint* ops) /* in: operation counts */
{ {
ulint i; ulint i;
...@@ -1277,8 +1273,8 @@ static ...@@ -1277,8 +1273,8 @@ static
void void
ibuf_print_ops( ibuf_print_ops(
/*===========*/ /*===========*/
ulint* ops, /* in: operation counts */ const ulint* ops, /* in: operation counts */
FILE* file) /* in: file where to print */ FILE* file) /* in: file where to print */
{ {
static const char* op_names[] = { static const char* op_names[] = {
"insert", "insert",
...@@ -1579,7 +1575,6 @@ ibuf_rec_get_volume( ...@@ -1579,7 +1575,6 @@ ibuf_rec_get_volume(
types = rec_get_nth_field_old(ibuf_rec, 1, &len); types = rec_get_nth_field_old(ibuf_rec, 1, &len);
ut_ad(len == n_fields * DATA_ORDER_NULL_TYPE_BUF_SIZE); ut_ad(len == n_fields * DATA_ORDER_NULL_TYPE_BUF_SIZE);
} else { } else {
/* >= 4.1.x format record */ /* >= 4.1.x format record */
ibuf_op_t op; ibuf_op_t op;
......
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