version 1.4, 2015/04/20 18:19:53
|
version 1.5, 2015/09/25 20:24:20
|
|
|
#include <stdio.h> | #include <stdio.h> |
#include "heap.h" | #include "heap.h" |
#include "types.h" | #include "types.h" |
|
#include <pal/intsafe.h> |
| |
#define MAGIC 0x41E25C10 | #define MAGIC 0x41E25C10 |
| |
|
|
if (!self) | if (!self) |
return NULL; | return NULL; |
| |
p = (MOF_Block*)PAL_Malloc(sizeof(MOF_Block) + size); |
size_t allocSize = 0; |
|
if (SizeTAdd(sizeof(MOF_Block), size, &allocSize) != S_OK) |
|
return NULL; |
|
|
|
p = (MOF_Block*)PAL_Malloc(allocSize); |
| |
if (!p) | if (!p) |
return NULL; | return NULL; |
|
|
if (!self) | if (!self) |
return NULL; | return NULL; |
| |
ptr = MOF_Malloc(self, count * size); |
size_t allocSize = 0; |
|
if (SizeTMult(count, size, &allocSize) != S_OK) |
|
return NULL; |
|
|
|
ptr = MOF_Malloc(self, allocSize); |
| |
if (!ptr) | if (!ptr) |
return NULL; | return NULL; |