Commit c476d38e authored by marko's avatar marko

branches/zip: Remove buf_block_t:magic_n.

buf_block_state_valid(): New macro for replacing the magic_n check
parent 728902ea
......@@ -356,7 +356,7 @@ btr_search_update_block_hash_info(
info->last_hash_succ = FALSE;
ut_a(block->magic_n == BUF_BLOCK_MAGIC_N);
ut_a(buf_block_state_valid(block));
ut_ad(info->magic_n == BTR_SEARCH_MAGIC_N);
if ((block->n_hash_helps > 0)
......
......@@ -603,8 +603,6 @@ buf_block_init(
buf_block_t* block, /* in: pointer to control block */
byte* frame) /* in: pointer to buffer frame */
{
block->magic_n = 0;
block->state = BUF_BLOCK_NOT_USED;
block->frame = frame;
......@@ -1783,8 +1781,6 @@ buf_page_init_for_backup_restore(
buf_block_t* block) /* in: block to init */
{
/* Set the state of the block */
block->magic_n = BUF_BLOCK_MAGIC_N;
buf_block_set_file_page(block, space, offset);
block->lock_hash_val = 0;
......@@ -1833,8 +1829,6 @@ buf_page_init(
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
/* Set the state of the block */
block->magic_n = BUF_BLOCK_MAGIC_N;
buf_block_set_file_page(block, space, offset);
block->check_index_page_at_flush = FALSE;
......
......@@ -708,7 +708,6 @@ struct buf_block_struct{
/* 1. General fields */
ulint magic_n; /* magic number to check */
ulint state; /* state of the control block:
BUF_BLOCK_NOT_USED, ...; changing
this is only allowed when a thread
......@@ -870,7 +869,10 @@ struct buf_block_struct{
#endif /* UNIV_DEBUG_FILE_ACCESSES */
};
#define BUF_BLOCK_MAGIC_N 41526563
/* Check if a block is in a valid state. */
#define buf_block_state_valid(block) \
(buf_block_get_state(block) >= BUF_BLOCK_NOT_USED \
&& (buf_block_get_state(block) <= BUF_BLOCK_REMOVE_HASH))
/* The buffer pool structure. NOTE! The definition appears here only for
other modules of this directory (buf) to see it. Do not use from outside! */
......
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