patch 4.0
This commit is contained in:
@ -19,17 +19,18 @@
|
||||
#include "lib/oblog/ob_log.h"
|
||||
#include "lib/allocator/ob_allocator.h"
|
||||
|
||||
|
||||
using namespace oceanbase::common;
|
||||
|
||||
void* parser_alloc_buffer(void* malloc_pool, const int64_t alloc_size)
|
||||
void *parser_alloc_buffer(void *malloc_pool, const int64_t alloc_size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
void* alloced_buf = NULL;
|
||||
void *alloced_buf = NULL;
|
||||
if (OB_ISNULL(malloc_pool)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid malloc pool", K(ret));
|
||||
} else {
|
||||
ObIAllocator* allocator = static_cast<ObIAllocator*>(malloc_pool);
|
||||
ObIAllocator *allocator = static_cast<ObIAllocator *>(malloc_pool);
|
||||
if (OB_ISNULL(alloced_buf = allocator->alloc(alloc_size))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to allocate memory", K(ret), K(alloc_size));
|
||||
@ -40,14 +41,14 @@ void* parser_alloc_buffer(void* malloc_pool, const int64_t alloc_size)
|
||||
return alloced_buf;
|
||||
}
|
||||
|
||||
void parser_free_buffer(void* malloc_pool, void* buffer)
|
||||
void parser_free_buffer(void *malloc_pool, void *buffer)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(malloc_pool)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid null malloc pool", K(ret));
|
||||
} else {
|
||||
ObIAllocator* allocator = static_cast<ObIAllocator*>(malloc_pool);
|
||||
ObIAllocator *allocator = static_cast<ObIAllocator *>(malloc_pool);
|
||||
allocator->free(buffer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user