deal with deprecated call
[xombrero.git] / netbsd / util.h
blob56b0422ab5ba50fb41a86c1576cfdea8a8f543de
1 #define RB_FOREACH(x, name, head) \
2 for ((x) = RB_MIN(name, head); \
3 (x) != NULL; \
4 (x) = name##_RB_NEXT(x))
6 #define RB_FOREACH_SAFE(x, name, head, y) \
7 for ((x) = RB_MIN(name, head); \
8 ((x) != NULL) && ((y) = name##_RB_NEXT(x), 1); \
9 (x) = (y))
11 #define RB_FOREACH_REVERSE(x, name, head) \
12 for ((x) = RB_MAX(name, head); \
13 (x) != NULL; \
14 (x) = name##_RB_PREV(x))
16 #define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
17 for ((x) = RB_MAX(name, head); \
18 ((x) != NULL) && ((y) = name##_RB_PREV(x), 1); \
19 (x) = (y))
22 #ifndef TAILQ_END
23 #define TAILQ_END(head) NULL
24 #endif
26 #ifndef TAILQ_FOREACH_SAFE
27 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
28 for ((var) = TAILQ_FIRST(head); \
29 (var) != TAILQ_END(head) && \
30 ((tvar) = TAILQ_NEXT(var, field), 1); \
31 (var) = (tvar))
32 #endif
34 #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
35 int fmt_scaled(long long number, char *result);
36 long long strtonum(const char *, long long, long long, const char **);