mirror of
https://github.com/openharmony/graphic_utils.git
synced 2026-07-20 19:45:49 -04:00
graphic utils malloc相关接口优化
Signed-off-by: i-wangliangliang <willfox@126.com> Change-Id: I595d9febe8ebc0ae09c5d58449ef6327f4faa7c9
This commit is contained in:
@@ -15,35 +15,31 @@
|
||||
|
||||
#include "gfx_utils/mem_api.h"
|
||||
namespace OHOS {
|
||||
#ifndef IMG_CACHE_MEMORY_CUSTOM
|
||||
void* ImageCacheMalloc(ImageInfo& info)
|
||||
__attribute__((weak)) void* ImageCacheMalloc(ImageInfo& info)
|
||||
{
|
||||
return malloc(info.dataSize);
|
||||
}
|
||||
|
||||
void ImageCacheFree(ImageInfo& info)
|
||||
__attribute__((weak)) void ImageCacheFree(ImageInfo& info)
|
||||
{
|
||||
uint8_t* buf = const_cast<uint8_t*>(info.data);
|
||||
free(buf);
|
||||
info.data = nullptr;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !ENABLE_MEMORY_HOOKS
|
||||
void* UIMalloc(uint32_t size)
|
||||
__attribute__((weak)) void* UIMalloc(uint32_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void UIFree(void* buffer)
|
||||
__attribute__((weak)) void UIFree(void* buffer)
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
void* UIRealloc(void* buffer, uint32_t size)
|
||||
__attribute__((weak)) void* UIRealloc(void* buffer, uint32_t size)
|
||||
{
|
||||
return realloc(buffer, size);
|
||||
}
|
||||
#endif
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -36,12 +36,9 @@
|
||||
#ifndef GRAPHIC_LITE_MEM_API_H
|
||||
#define GRAPHIC_LITE_MEM_API_H
|
||||
|
||||
#include "graphic_config.h"
|
||||
#include "gfx_utils/image_info.h"
|
||||
|
||||
#ifndef IMG_CACHE_MEMORY_CUSTOM
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user