diff options
| author | stkhan <personal@slickd.xyz> | 2022-05-07 12:42:36 +0000 |
|---|---|---|
| committer | stkhan <personal@slickd.xyz> | 2022-05-07 12:42:36 +0000 |
| commit | 0f734f0e317996d246fed2b0bdd1550c49d46e5b (patch) | |
| tree | db0f535dcb02dc1959508a1e94570db74ea3bbb2 /sfm-0.4/util.h | |
| parent | 42966e3e531b8e46e4ab31480d45aa7a141f19ce (diff) | |
Fixed things, added sfm
Diffstat (limited to 'sfm-0.4/util.h')
| -rw-r--r-- | sfm-0.4/util.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sfm-0.4/util.h b/sfm-0.4/util.h new file mode 100644 index 0000000..2ade6d5 --- /dev/null +++ b/sfm-0.4/util.h @@ -0,0 +1,17 @@ +/* See LICENSE file for copyright and license details. */ + +#ifndef UTIL_H +#define UTIL_H + +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#define MIN(A, B) ((A) < (B) ? (A) : (B)) +#define LEN(A) (sizeof(A)/sizeof(A[0])) +#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) +#define FAIL_IF(EXP, MSG) {if(EXP){fprintf(stderr, "[\033[31mFAILED %d\033[0m] %s\n", __LINE__, MSG);exit(EXIT_FAILURE);}} +#define PERROR(EXP) {if(EXP){print_error(strerror(errno));}}; + +void *ecalloc(size_t, size_t); +void *erealloc(void*, size_t); +void die(const char *fmt, ...); + +#endif /* UTIL_H */ |