graphic utils malloc相关接口优化

Signed-off-by: i-wangliangliang <willfox@126.com>
Change-Id: I595d9febe8ebc0ae09c5d58449ef6327f4faa7c9
This commit is contained in:
i-wangliangliang
2022-09-05 17:23:40 +08:00
parent 6f1570b31a
commit c0a8577474
2 changed files with 5 additions and 12 deletions
+5 -9
View File
@@ -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
-3
View File
@@ -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 {
/**