Ai
1 Star 5 Fork 8

vtor3478/vtor_elec_module

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vtor_heap.h 2.28 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef __VTOR_HEAP_H__
#define __VTOR_HEAP_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "vtor_elec_module_config.h"
//#include "vtor_printf.h"
#ifdef __VTOR_HEAP__
typedef struct VtorHeapNodeStruct
{
struct VtorHeapNodeStruct* nextHeapNode;
int heapLen;
int heapHeadMagicNumber;
}VtorHeapNode;
// 禁用调试打印
#define VtorHeapDebug(...)
// vs平台直接使用c库
//#define VtorHeapDebug(...) printf(__VA_ARGS__)
// 使用vtorprintf打印
//#define VtorHeapDebug(...) VtorDebugPrintf(__VA_ARGS__)
// 对齐,
#define VTOR_HEAP_ALIGNED 4
#define VtorHeapMallocNumber 0xa11ca11c // malloc 代表给程序员
#define VtorHeapFreeNumber 0xfeeefeee // free 代表属于操作系统
#define VtorHeap_Init(heapBuf, heapSize) VtorHeapx_Init(0, heapBuf, heapSize)
#define VtorHeap_Malloc(userSize) VtorHeapx_Malloc(0, userSize)
#define VtorHeap_Free(heapBuf) VtorHeapx_Free(0, heapBuf)
#define VtorHeap_Realloc(heapBuf, newsize) VtorHeapx_Realloc(0, heapBuf, newsize)
#define VtorHeap0_Init(heapBuf, heapSize) VtorHeapx_Init(0, heapBuf, heapSize)
#define VtorHeap0_Malloc(userSize) VtorHeapx_Malloc(0, userSize)
#define VtorHeap0_Free(heapBuf) VtorHeapx_Free(0, heapBuf)
#define VtorHeap0_Realloc(heapBuf, newsize) VtorHeapx_Realloc(0, heapBuf, newsize)
#define VtorHeap1_Init(heapBuf, heapSize) VtorHeapx_Init(1, heapBuf, heapSize)
#define VtorHeap1_Malloc(userSize) VtorHeapx_Malloc(1, userSize)
#define VtorHeap1_Free(heapBuf) VtorHeapx_Free(1, heapBuf)
#define VtorHeap1_Realloc(heapBuf, newsize) VtorHeapx_Realloc(1, heapBuf, newsize)
#define VtorHeap2_Init(heapBuf, heapSize) VtorHeapx_Init(2, heapBuf, heapSize)
#define VtorHeap2_Malloc(userSize) VtorHeapx_Malloc(2, userSize)
#define VtorHeap2_Free(heapBuf) VtorHeapx_Free(2, heapBuf)
#define VtorHeap2_Realloc(heapBuf, newsize) VtorHeapx_Realloc(2, heapBuf, newsize)
void VtorHeap_SetHeadNode(int heapIdx, void* heapBuf);
VtorHeapNode* VtorHeap_GetHeadNode(int heapIdx);
VtorHeapNode* VtorHeapx_Init(int heapIdx, void* heapBuf, int heapSize);
void VtorHeap_PrintInfo(int heapIdx);
void* VtorHeapx_Malloc(int heapIdx, int userSize);
void VtorHeapx_Free(int heapIdx, void* heapBuf);
void* VtorHeapx_Realloc(int heapIdx, void* heapBuf, int newsize);
#endif // __VTOR_HEAP__
#ifdef __cplusplus
}
#endif
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/vtor3478/vtor_elec_module.git
git@gitee.com:vtor3478/vtor_elec_module.git
vtor3478
vtor_elec_module
vtor_elec_module
main

搜索帮助