mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
remove dead code
This commit is contained in:
parent
65bd38204b
commit
b66164ab56
6 changed files with 0 additions and 514 deletions
|
|
@ -327,102 +327,6 @@ mem_heap_get_top(
|
|||
return((void*) buf);
|
||||
}
|
||||
|
||||
/** Checks if a given chunk of memory is the topmost element stored in the
|
||||
heap. If this is the case, then calling mem_heap_free_top() would free
|
||||
that element from the heap.
|
||||
@param[in] heap memory heap
|
||||
@param[in] buf presumed topmost element
|
||||
@param[in] buf_sz size of buf in bytes
|
||||
@return true if topmost */
|
||||
UNIV_INLINE
|
||||
bool
|
||||
mem_heap_is_top(
|
||||
mem_heap_t* heap,
|
||||
const void* buf,
|
||||
ulint buf_sz)
|
||||
{
|
||||
const byte* first_free_byte;
|
||||
const byte* presumed_start_of_buf;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
first_free_byte = mem_heap_get_heap_top(heap);
|
||||
|
||||
presumed_start_of_buf = first_free_byte - MEM_SPACE_NEEDED(buf_sz);
|
||||
|
||||
return(presumed_start_of_buf == buf);
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Allocate a new chunk of memory from a memory heap, possibly discarding
|
||||
the topmost element. If the memory chunk specified with (top, top_sz)
|
||||
is the topmost element, then it will be discarded, otherwise it will
|
||||
be left untouched and this function will be equivallent to
|
||||
mem_heap_alloc().
|
||||
@return allocated storage, NULL if did not succeed (only possible for
|
||||
MEM_HEAP_BTR_SEARCH type heaps) */
|
||||
UNIV_INLINE
|
||||
void*
|
||||
mem_heap_replace(
|
||||
/*=============*/
|
||||
mem_heap_t* heap, /*!< in/out: memory heap */
|
||||
const void* top, /*!< in: chunk to discard if possible */
|
||||
ulint top_sz, /*!< in: size of top in bytes */
|
||||
ulint new_sz) /*!< in: desired size of the new chunk */
|
||||
{
|
||||
if (mem_heap_is_top(heap, top, top_sz)) {
|
||||
mem_heap_free_top(heap, top_sz);
|
||||
}
|
||||
|
||||
return(mem_heap_alloc(heap, new_sz));
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Allocate a new chunk of memory from a memory heap, possibly discarding
|
||||
the topmost element and then copy the specified data to it. If the memory
|
||||
chunk specified with (top, top_sz) is the topmost element, then it will be
|
||||
discarded, otherwise it will be left untouched and this function will be
|
||||
equivallent to mem_heap_dup().
|
||||
@return allocated storage, NULL if did not succeed (only possible for
|
||||
MEM_HEAP_BTR_SEARCH type heaps) */
|
||||
UNIV_INLINE
|
||||
void*
|
||||
mem_heap_dup_replace(
|
||||
/*=================*/
|
||||
mem_heap_t* heap, /*!< in/out: memory heap */
|
||||
const void* top, /*!< in: chunk to discard if possible */
|
||||
ulint top_sz, /*!< in: size of top in bytes */
|
||||
const void* data, /*!< in: new data to duplicate */
|
||||
ulint data_sz)/*!< in: size of data in bytes */
|
||||
{
|
||||
void* p = mem_heap_replace(heap, top, top_sz, data_sz);
|
||||
|
||||
memcpy(p, data, data_sz);
|
||||
|
||||
return(p);
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Allocate a new chunk of memory from a memory heap, possibly discarding
|
||||
the topmost element and then copy the specified string to it. If the memory
|
||||
chunk specified with (top, top_sz) is the topmost element, then it will be
|
||||
discarded, otherwise it will be left untouched and this function will be
|
||||
equivallent to mem_heap_strdup().
|
||||
@return allocated string, NULL if did not succeed (only possible for
|
||||
MEM_HEAP_BTR_SEARCH type heaps) */
|
||||
UNIV_INLINE
|
||||
char*
|
||||
mem_heap_strdup_replace(
|
||||
/*====================*/
|
||||
mem_heap_t* heap, /*!< in/out: memory heap */
|
||||
const void* top, /*!< in: chunk to discard if possible */
|
||||
ulint top_sz, /*!< in: size of top in bytes */
|
||||
const char* str) /*!< in: new data to duplicate */
|
||||
{
|
||||
return(reinterpret_cast<char*>(mem_heap_dup_replace(
|
||||
heap, top, top_sz, str, strlen(str) + 1)));
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Frees the topmost element in a memory heap. The size of the element must be
|
||||
given. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue