21 |
# define XALLOC_H_ |
# define XALLOC_H_ |
22 |
|
|
23 |
# include <stddef.h> |
# include <stddef.h> |
24 |
|
# include <stdlib.h> |
25 |
|
|
26 |
# ifndef __attribute__ |
# ifndef __attribute__ |
27 |
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ |
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ |
62 |
# define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1) |
# define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1) |
63 |
|
|
64 |
/* Free VAR only if non NULL. */ |
/* Free VAR only if non NULL. */ |
65 |
# define XFREE(Var) \ |
# define XFREE(Var) xfree (Var) |
66 |
do { \ |
static inline void |
67 |
if (Var) \ |
xfree (void *p) |
68 |
free (Var); \ |
{ |
69 |
} while (0) |
if (p) |
70 |
|
free (p); |
71 |
|
} |
72 |
|
|
73 |
/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */ |
/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */ |
74 |
# define CCLONE(Src, Num) \ |
# define CCLONE(Src, Num) \ |