aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-03-09 05:53:40 -0400
committerMike Frysinger <vapier@gentoo.org>2009-03-09 05:53:40 -0400
commit7fa9c03083e90cdb8476ff3dc8154572d71aa852 (patch)
tree6dc4b55c5c123fede5d55459ef36c54c26bee2b1 /localdecls.h
parenttests: do not sscanf("%i", mode_t) (diff)
downloadsandbox-7fa9c03083e90cdb8476ff3dc8154572d71aa852.tar.gz
sandbox-7fa9c03083e90cdb8476ff3dc8154572d71aa852.tar.bz2
sandbox-7fa9c03083e90cdb8476ff3dc8154572d71aa852.zip
bump common macros up to localdecls.h so tests can use them
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'localdecls.h')
-rw-r--r--localdecls.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/localdecls.h b/localdecls.h
index 2567ccd..595a5ac 100644
--- a/localdecls.h
+++ b/localdecls.h
@@ -63,6 +63,19 @@ typedef __sighandler_t sighandler_t;
# endif
#endif
+#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
+
/* If the system is old and does not support *at funcs, then define
* it ourself. Shouldn't matter based on how we use it.
*/