aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-01-29 11:13:12 -0500
committerMike Frysinger <vapier@gentoo.org>2009-01-29 11:13:20 -0500
commitdddd2da9feeeba54b3b75d345f2f38ba20e7d47a (patch)
tree046b3ca72c1e851575fc9ca15236bbddd15133f2 /libsbutil
parentconfigure: dont bother building libctest with -Wall (diff)
downloadsandbox-dddd2da9feeeba54b3b75d345f2f38ba20e7d47a.tar.gz
sandbox-dddd2da9feeeba54b3b75d345f2f38ba20e7d47a.tar.bz2
sandbox-dddd2da9feeeba54b3b75d345f2f38ba20e7d47a.zip
libsbutil: setup {offsetof,MIN,MAX} helper macros if they dont exist
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsbutil')
-rw-r--r--libsbutil/sbutil.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h
index 68c649e..4ce4c13 100644
--- a/libsbutil/sbutil.h
+++ b/libsbutil/sbutil.h
@@ -16,7 +16,18 @@
#include "headers.h"
#include "include/rcscripts/rcutil.h"
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+#endif
+#ifndef MAX
+#define MAX(x, y) ((x) < (y) ? (y) : (x))
+#endif
+#ifndef MIN
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#endif
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
#define SANDBOX_CONF_FILE ETCDIR "/sandbox.conf"
#define SANDBOX_CONFD_DIR ETCDIR "/sandbox.d"