implicit free - catch anyway.. and set ptr to NULL
SVN revision: 5628
This commit is contained in:
parent
5665ed7023
commit
6e2671c45c
|
@ -58,12 +58,14 @@
|
|||
{if (dat) FREE(dat);}
|
||||
#define REALLOC(dat, type, num) \
|
||||
{ \
|
||||
if (dat) dat = realloc((dat), sizeof(type) * (num)); \
|
||||
if ((dat) && (num == 0)) {free(dat); dat = NULL;} \
|
||||
else if (dat) dat = realloc((dat), sizeof(type) * (num)); \
|
||||
else dat = malloc(sizeof(type) * (num)); \
|
||||
}
|
||||
#define REALLOC_PTR(dat, num) \
|
||||
{ \
|
||||
if (dat) dat = realloc(dat, sizeof(void *) * (num)); \
|
||||
if ((dat) && (num == 0)) {free(dat); dat = NULL;} \
|
||||
else if (dat) dat = realloc(dat, sizeof(void *) * (num)); \
|
||||
else dat = malloc(sizeof(void *) * (num)); \
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue