#include <stdlib.h>
#include <string.h>
+#include "config.h"
+
/*
* Define a keyword for use while defining small and fast functions.
return a < b ? b : a;
}
-
/*
- * Define some macros for packing and unpacking bytes to and from larger ints.
+ * Define generic MIN and MAX macros.
*/
-#define PACK(W,N,B) (((B) << (8 * (N))) | ((W) & ~(0xff << (8 * (N)))))
-#define UNPACK(W,N) ((uint8_t)((W) >> (8 * (N))) & 0xff)
+#ifndef MIN
+#define MIN(A,B) (((A) < (B)) ? (A) : (B))
+#endif
+#ifndef MAX
+#define MAX(A,B) (((A) > (B)) ? (A) : (B))
+#endif
/*
* an error condition and an abort(3) occurs.
* return.
*/
+#if VERBOSITY >= 1
#define TRY_DO(L, K, ARGS...) \
printf("* " L "... ", ##ARGS); \
fflush(stdout); \
if ((K) == 0) printf("done!\n"); \
else abort()
+#else
+#define TRY_DO(L, K, ARGS...) \
+if ((K) != 0) abort()
+#endif
/*
* Trim white space off of both sides of a string.
*/
INLINE_MAYBE
-void trim(char *str)
+char* trim(char *str)
{
rtrim(str);
ltrim(str);
+ return str;
}