1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-12 08:01:43 +03:00

branches/zip: Silence most GCC 4.2.1 warnings about const pointers.

For some reason, GCC 4.2.1 ignores casts (for removing constness)
in calls to inline functions.

page_align(), ut_align_down(): Make the parameter const void*, but still
return a non-const pointer.  This is ugly, but these functions cannot be
replaced with a const-preserving macro in a portable way, given that
the pointer argument is not always pointing to bytes.

buf_block_get_page_zip(): Implement as a const-preserving macro.

buf_frame_get_page_zip(), buf_block_align(): Add const qualifiers.

lock_rec_get_prev(): Silence GCC 4.2.1 warnings.

mlog_write_initial_log_record(), mlog_write_initial_log_record_fast(),
mtr_memo_contains(): Add const qualifier to the pointer.

page_header_get_ptr(): Rewrite as page_header_get_offs(), and
implement as a macro that calls this function.
This commit is contained in:
marko
2007-10-03 12:22:29 +00:00
parent e9507ea69b
commit 2ddbc912e7
20 changed files with 146 additions and 149 deletions

View File

@@ -854,32 +854,26 @@ buf_block_get_zip_size(
/*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
UNIV_INLINE
page_zip_des_t*
buf_block_get_page_zip(
/*===================*/
/* out: compressed page descriptor, or NULL */
buf_block_t* block) /* in: pointer to the control block */
__attribute((pure));
#define buf_block_get_page_zip(block) \
(UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL)
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/***********************************************************************
Gets the block to whose frame the pointer is pointing to. */
UNIV_INLINE
buf_block_t*
const buf_block_t*
buf_block_align(
/*============*/
/* out: pointer to block */
byte* ptr); /* in: pointer to a frame */
/* out: pointer to block */
const byte* ptr); /* in: pointer to a frame */
/*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
UNIV_INLINE
page_zip_des_t*
const page_zip_des_t*
buf_frame_get_page_zip(
/*===================*/
/* out: compressed page descriptor, or NULL */
byte* ptr) /* in: pointer to the page */
__attribute((pure));
/* out: compressed page descriptor, or NULL */
const byte* ptr); /* in: pointer to the page */
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/************************************************************************
This function is used to get info if there is an io operation