Commit 75e35eb7 authored by marko's avatar marko

branches/zip: Minor cleanup.

buf_buddy_get(): New function in buf0buddy.c, to replace the macro
in buf0buddy.h.

buf_buddy_get_offset(): Remove.

buf_buddy_get_slot(): Remove the prototype from buf0buddy.h.  This function
is for internal use in buf0buddy.ic.
parent c087a5d5
......@@ -17,6 +17,28 @@ Created December 2006 by Marko Makela
#include "buf0flu.h"
#include "page0zip.h"
/**************************************************************************
Get the offset of the buddy of a compressed page frame. */
UNIV_INLINE
byte*
buf_buddy_get(
/*==========*/
/* out: the buddy relative of page */
byte* page, /* in: compressed page */
ulint size) /* in: page size in bytes */
{
ut_ad(ut_is_2pow(size));
ut_ad(size >= BUF_BUDDY_LOW);
ut_ad(size < BUF_BUDDY_HIGH);
ut_ad(!ut_align_offset(page, size));
if (((ulint) page) & size) {
return(page - size);
} else {
return(page + size);
}
}
/**************************************************************************
Try to allocate a block from buf_pool->zip_free[]. */
static
......
......@@ -17,32 +17,6 @@ Created December 2006 by Marko Makela
#include "univ.i"
#include "buf0types.h"
/**************************************************************************
Get the offset of the buddy of a compressed page frame. */
UNIV_INLINE
lint
buf_buddy_get_offset(
/*=================*/
/* out: offset of the buddy relative to page */
const void* page, /* in: compressed page */
ulint size) /* in: page size in bytes */
__attribute__((nonnull));
/**************************************************************************
Get the buddy of a compressed page frame.
Note: "page" should be a pointer to byte or char. */
#define buf_buddy_get(page,size) ((page) + buf_buddy_get_offset((page),(size)))
/**************************************************************************
Get the index of buf_pool->zip_free[] for a given block size. */
UNIV_INLINE
ulint
buf_buddy_get_slot(
/*===============*/
/* out: index of buf_pool->zip_free[],
or BUF_BUDDY_SIZES */
ulint size); /* in: block size */
/**************************************************************************
Allocate a block. */
UNIV_INLINE
......
......@@ -42,27 +42,6 @@ buf_buddy_free_low(
or BUF_BUDDY_SIZES */
__attribute__((nonnull));
/**************************************************************************
Get the offset of the buddy of a compressed page frame. */
UNIV_INLINE
lint
buf_buddy_get_offset(
/*=================*/
/* out: offset of the buddy relative to page */
const void* page, /* in: compressed page */
ulint size) /* in: page size in bytes */
{
ut_ad(ut_is_2pow(size));
ut_ad(size >= BUF_BUDDY_LOW);
ut_ad(size < BUF_BUDDY_HIGH);
if (((ulint) page) & size) {
return(-(lint) size);
} else {
return((lint) size);
}
}
/**************************************************************************
Get the index of buf_pool->zip_free[] for a given block size. */
UNIV_INLINE
......
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