Statement expressions are a GNU C extension and are not available
in ISO C.
On compilers that don't have them, define these macros as plain
conditional expressions, since they are only ever used with expressions
that have no side-effects.
The statement-expression version is still retained as an added
safety measure on GNU-compatible compilers.
Signed-off-by: Michael Forney <mforney@mforney.org>
#undef min
#undef max
+#ifdef __GNUC__
#define min(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; \
})
+#else
+#define min(a,b) ((a) > (b) ? (b) : (a))
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
static inline bool
startswith(const char *str, size_t len, const char *prefix, size_t plen)