summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-11 21:30:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:39 -0500
commitbc13766a76c88e45117c8a1fd95a08d2c96789cd (patch)
treec360ec106d9fe412fa1c7859fe4ec26309e51de7 /source4/lib/replace
parentf3e13632813c543583fe1d04203825743aa99111 (diff)
downloadsamba-bc13766a76c88e45117c8a1fd95a08d2c96789cd.tar.gz
samba-bc13766a76c88e45117c8a1fd95a08d2c96789cd.tar.bz2
samba-bc13766a76c88e45117c8a1fd95a08d2c96789cd.zip
r24337: Make libreplace provide offsetof.
(This used to be commit 48d1aa4fcf6a323e3e6a14825f83cd20e3fc3a26)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/README1
-rw-r--r--source4/lib/replace/replace.h4
2 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/replace/README b/source4/lib/replace/README
index 77558b2ca9..e7b89936c0 100644
--- a/source4/lib/replace/README
+++ b/source4/lib/replace/README
@@ -92,6 +92,7 @@ ZERO_STRUCTPN
ZERO_ARRAY
ARRAY_SIZE
PTR_DIFF
+offsetof
Headers:
stdint.h
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index 06173bd84b..e827719951 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -52,6 +52,10 @@
#define QSORT_CAST (int (*)(const void *, const void *))
#endif
+#ifndef offsetof
+#define offsetof(t,f) ((unsigned int)&((t *)0)->f)
+#endif
+
#ifdef HAVE_STDINT_H
#include <stdint.h>
/* force off HAVE_INTTYPES_H so that roken doesn't try to include both,