00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __malloc_h
00009 #define __malloc_h
00010
00011 #include <utility/heap.h>
00012
00013 __BEGIN_SYS
00014 extern Heap app_heap;
00015 __END_SYS
00016
00017 inline void * malloc(unsigned int bytes) {
00018 return __SYS(app_heap).alloc(bytes);
00019 }
00020 inline void * calloc(unsigned int n, unsigned int bytes) {
00021 return __SYS(app_heap).calloc(n * bytes);
00022 }
00023 inline void * realloc(void * ptr, unsigned int bytes) {
00024 return __SYS(app_heap).realloc(ptr, bytes);
00025 }
00026 inline void free(void * ptr) {
00027 __SYS(app_heap).free(ptr);
00028 }
00029
00030 inline void * operator new(unsigned int bytes) {
00031 return __SYS(app_heap).alloc(bytes);
00032 }
00033 inline void * operator new[](unsigned int bytes) {
00034 return __SYS(app_heap).alloc(bytes);
00035 }
00036 inline void operator delete(void * object) {
00037 __SYS(app_heap).free(object);
00038 }
00039
00040
00041
00042 #endif