cmalloc.cpp
来自「eC++编译器源码」· C++ 代码 · 共 31 行
CPP
31 行
/***
*malloc.h - declarations and definitions for memory allocation functions
*Purpose:
* Contains the function declarations for memory allocation functions.
*
****/
#pragma cmalloc
#include <SYSTEM.h>
#include <Storage.h>
void free(ADDRESS &p)
{
long *p1;
typedef unsigned int c;
p1 = p-LONG(sizeof(long)*2);
DEALLOCATE(p, c(TRUNC(*p1)));
};
ADDRESS malloc(unsigned int size)
{
long *p;
INC(size, sizeof(long));
ALLOCATE(p, size);
*p = LONG(size);
return ADDRESS(p)+LONG(sizeof(long)*2);
};
void cmalloc(void)
{
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?