summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-02-20 20:40:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:57 -0500
commit595702c9faff4baf148901847a45b5a197ce92d5 (patch)
tree2b0fd803802f056130493b13a93846a1702f5d5b /source4/lib/replace
parent5fa874453f0e11b49d43043eef855e953acacc46 (diff)
downloadsamba-595702c9faff4baf148901847a45b5a197ce92d5.tar.gz
samba-595702c9faff4baf148901847a45b5a197ce92d5.tar.bz2
samba-595702c9faff4baf148901847a45b5a197ce92d5.zip
r13577: Move some (possibly system-defined) defines to replace.h
(This used to be commit 2b3d56e153b229119fddfa7b378f4d671ee0092c)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/replace.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index 0f1eb42ac0..24876ffd4e 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -162,6 +162,14 @@ int rep_mkstemp(char *temp);
#include <limits.h>
#endif
+/* The extra casts work around common compiler bugs. */
+#define _TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
+ It is necessary at least when t == time_t. */
+#define _TYPE_MINIMUM(t) ((t) (_TYPE_SIGNED (t) \
+ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
+#define _TYPE_MAXIMUM(t) ((t) (~ (t) 0 - _TYPE_MINIMUM (t)))
+
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 64
#endif
@@ -178,4 +186,12 @@ int rep_mkstemp(char *temp);
#define UINT64_MAX ((uint64_t)-1)
#endif
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
+#ifndef INT32_MAX
+#define INT32_MAX _TYPE_MAXIMUM(int32_t)
+#endif
+
#endif