branches/zip: Define buf_block_get_frame() as a const-preserving macro.

This commit is contained in:
marko 2007-09-28 06:26:21 +00:00
parent 14b700688b
commit 44f9d06969
2 changed files with 12 additions and 8 deletions

View file

@ -774,16 +774,19 @@ buf_page_set_accessed(
/*==================*/ /*==================*/
buf_page_t* bpage, /* in/out: control block */ buf_page_t* bpage, /* in/out: control block */
ibool accessed); /* in: accessed */ ibool accessed); /* in: accessed */
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Gets a pointer to the memory frame of a block. */ Gets a pointer to the memory frame of a block. */
UNIV_INLINE UNIV_INLINE
buf_frame_t* buf_frame_t*
buf_block_get_frame( buf_block_get_frame(
/*================*/ /*================*/
/* out: pointer to the frame */ /* out: pointer to the frame */
buf_block_t* block) /* in: pointer to the control block */ const buf_block_t* block) /* in: pointer to the control block */
__attribute__((pure)); __attribute__((pure));
#else /* UNIV_DEBUG */
# define buf_block_get_frame(block) block->frame
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Gets the space id of a block. */ Gets the space id of a block. */
UNIV_INLINE UNIV_INLINE

View file

@ -460,17 +460,18 @@ buf_page_set_accessed(
bpage->accessed = accessed; bpage->accessed = accessed;
} }
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Gets a pointer to the memory frame of a block. */ Gets a pointer to the memory frame of a block. */
UNIV_INLINE UNIV_INLINE
buf_frame_t* buf_frame_t*
buf_block_get_frame( buf_block_get_frame(
/*================*/ /*================*/
/* out: pointer to the frame */ /* out: pointer to the frame */
buf_block_t* block) /* in: pointer to the control block */ const buf_block_t* block) /* in: pointer to the control block */
{ {
ut_ad(block); ut_ad(block);
#ifdef UNIV_DEBUG
switch (buf_block_get_state(block)) { switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
@ -488,9 +489,9 @@ buf_block_get_frame(
} }
ut_error; ut_error;
ok: ok:
#endif /* UNIV_DEBUG */ return((buf_frame_t*) block->frame);
return(block->frame);
} }
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Gets the space id of a block. */ Gets the space id of a block. */