2012-12-08 09:13:01 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
|
|
|
|
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
|
|
|
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
2015-03-06 04:26:11 +00:00
|
|
|
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
2024-10-05 11:01:49 +00:00
|
|
|
#define LENGTH(X) (sizeof (X) / sizeof (X)[0])
|
2012-12-08 09:13:01 +00:00
|
|
|
|
2024-11-30 01:31:12 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define DEBUG(...)
|
|
|
|
#endif
|
|
|
|
|
2016-05-22 20:33:56 +00:00
|
|
|
void die(const char *fmt, ...);
|
|
|
|
void *ecalloc(size_t nmemb, size_t size);
|
2024-11-30 01:31:12 +00:00
|
|
|
int normalizepath(const char *path, char **normal);
|
|
|
|
int mkdirp(const char *path);
|
|
|
|
int parentdir(const char *path, char **parent);
|
|
|
|
int nullterminate(char **str, size_t *len);
|