mirror of https://github.com/axmolengine/axmol.git
Update extension.h
#define MALLOC(TYPE,COUNT) ((TYPE*)_malloc(sizeof(TYPE) * COUNT, __FILE__, __LINE__)) It is a really dangerous macros here. If use it like this "MALLOC(Type, n+2)", it will alloc sizeof(TYPE) * COUNT + 2 byte memory.but I want it alloc sizeof(TYPE) * (COUNT + 2) byte. It is a typical macro unwind error.
This commit is contained in:
parent
cb3b760759
commit
b8a022238f
|
@ -32,7 +32,7 @@
|
|||
#define SPINE_EXTENSION_H_
|
||||
|
||||
/* All allocation uses these. */
|
||||
#define MALLOC(TYPE,COUNT) ((TYPE*)_malloc(sizeof(TYPE) * COUNT, __FILE__, __LINE__))
|
||||
#define MALLOC(TYPE,COUNT) ((TYPE*)_malloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
|
||||
#define CALLOC(TYPE,COUNT) ((TYPE*)_calloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
|
||||
#define NEW(TYPE) CALLOC(TYPE,1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue