blob: 8b8736373d98962b32dd4d0e6d2741e1860fd33e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#ifndef DO_COMMON_H
#define DO_COMMON_H
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "str.h"
#include "target.h"
#include "targetlist.h"
#define safe_free(PTR) { \
do { \
free((PTR)); \
(PTR) = NULL; \
} while (0); \
}
#define safe_free_array(PTR, LEN) { \
do { \
for (size_t p = 0; p < (LEN); p++) { free((PTR)[p]); } \
free((PTR)); \
} while (0); \
}
#endif //DO_COMMON_H
|