diff options
Diffstat (limited to 'common.h')
| -rw-r--r-- | common.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/common.h b/common.h new file mode 100644 index 0000000..b8c38e0 --- /dev/null +++ b/common.h @@ -0,0 +1,27 @@ +#ifndef DO_COMMON_H +#define DO_COMMON_H + +#include <stdlib.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
\ No newline at end of file |
