-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathutil.h
17 lines (15 loc) · 934 Bytes
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* See LICENSE file for copyright and license details. */
/* Macro that chooses the maximum of two values. If used with a function call then that call may
* be called twice due to how the macro unfolds in the code. */
#define MAX(A, B) ((A) > (B) ? (A) : (B))
/* Macro that chooses the minimum of two values. If used with a function call then that call may
* be called twice due to how the macro unfolds in the code. */
#define MIN(A, B) ((A) < (B) ? (A) : (B))
/* Macro that is true if a value is between two values. If used with a function call then that
* call will happen twice due to how the macro unfolds in the code. */
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
/* This calculates the number of items of an array. */
#define LENGTH(X) (sizeof X / sizeof X[0])
/* Function declarations. */
void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);