diff options
Diffstat (limited to 'storage/innobase/mem/mem0mem.cc')
-rw-r--r-- | storage/innobase/mem/mem0mem.cc | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc index e53d200b776..929bffb881c 100644 --- a/storage/innobase/mem/mem0mem.cc +++ b/storage/innobase/mem/mem0mem.cc @@ -29,31 +29,6 @@ Created 6/9/1994 Heikki Tuuri #include "srv0srv.h" #include <stdarg.h> -/** Duplicates a NUL-terminated string, allocated from a memory heap. -@param[in] heap, memory heap where string is allocated -@param[in] str) string to be copied -@return own: a copy of the string */ -char* -mem_heap_strdup( - mem_heap_t* heap, - const char* str) -{ - return(static_cast<char*>(mem_heap_dup(heap, str, strlen(str) + 1))); -} - -/**********************************************************************//** -Duplicate a block of data, allocated from a memory heap. -@return own: a copy of the data */ -void* -mem_heap_dup( -/*=========*/ - mem_heap_t* heap, /*!< in: memory heap where copy is allocated */ - const void* data, /*!< in: data to be copied */ - ulint len) /*!< in: length of data, in bytes */ -{ - return(memcpy(mem_heap_alloc(heap, len), data, len)); -} - /**********************************************************************//** Concatenate two strings and return the result, using a memory heap. @return own: the result */ @@ -149,7 +124,7 @@ mem_heap_printf_low( val = va_arg(ap, unsigned long); - plen = sprintf(tmp, "%lu", val); + plen = size_t(sprintf(tmp, "%lu", val)); len += plen; if (buf) { @@ -242,7 +217,7 @@ mem_heap_validate( break; case MEM_HEAP_BUFFER: case MEM_HEAP_BUFFER | MEM_HEAP_BTR_SEARCH: - ut_ad(block->len <= UNIV_PAGE_SIZE); + ut_ad(block->len <= srv_page_size); break; default: ut_error; @@ -287,13 +262,13 @@ mem_heap_create_block_func( /* In dynamic allocation, calculate the size: block header + data. */ len = MEM_BLOCK_HEADER_SIZE + MEM_SPACE_NEEDED(n); - if (type == MEM_HEAP_DYNAMIC || len < UNIV_PAGE_SIZE / 2) { + if (type == MEM_HEAP_DYNAMIC || len < srv_page_size / 2) { ut_ad(type == MEM_HEAP_DYNAMIC || n <= MEM_MAX_ALLOC_IN_BUF); block = static_cast<mem_block_t*>(ut_malloc_nokey(len)); } else { - len = UNIV_PAGE_SIZE; + len = srv_page_size; if ((type & MEM_HEAP_BTR_SEARCH) && heap) { /* We cannot allocate the block from the @@ -435,7 +410,7 @@ mem_heap_block_free( len = block->len; block->magic_n = MEM_FREED_BLOCK_MAGIC_N; - if (type == MEM_HEAP_DYNAMIC || len < UNIV_PAGE_SIZE / 2) { + if (type == MEM_HEAP_DYNAMIC || len < srv_page_size / 2) { ut_ad(!buf_block); ut_free(block); } else { |