diff options
author | marcel <marcel@FreeBSD.org> | 1999-12-23 19:58:09 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 1999-12-23 19:58:09 +0000 |
commit | ed6a1fb0ef00f1388cfb6aebfd3157733fe49e4c (patch) | |
tree | 87a25babb4b2f0e0b4e691914db6fe43299cb877 /sys | |
parent | 4448e3bd05118cef4555d4b62c24873cb6da72e2 (diff) | |
download | FreeBSD-src-ed6a1fb0ef00f1388cfb6aebfd3157733fe49e4c.zip FreeBSD-src-ed6a1fb0ef00f1388cfb6aebfd3157733fe49e4c.tar.gz |
o Define `offsetof' when not already defined,
o Define ASSYM(sym, v) as the primary macro to use,
o Define ASSYM_SELF and ASSYM_OFFSET in terms of ASSYM,
Psychological manipulation by: bde <grin>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/assym.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/sys/assym.h b/sys/sys/assym.h index 0f481e0..230d1f5 100644 --- a/sys/sys/assym.h +++ b/sys/sys/assym.h @@ -31,12 +31,17 @@ #ifndef _SYS_ASSYM_H_ #define _SYS_ASSYM_H_ -#ifndef ASSYM -#define ASSYM(sym, v) unsigned long sym = (unsigned long)v +#ifndef offsetof +#define offsetof(s, m) (&((struct s*)0)->m) #endif -#define ASSYM_SELF(sym) ASSYM(assym_##sym, sym) -#define ASSYM_CONST(sym, v) ASSYM(assym_##sym, v) -#define ASSYM_OFFSET(sym, s, m) ASSYM(assym_##sym, (&((struct s*)0)->m)) +#ifndef __assym +#define __assym(sym, v) unsigned long sym = (unsigned long)v +#endif + +#define ASSYM(sym, v) __assym(assym_##sym, v) + +#define ASSYM_SELF(sym) ASSYM(sym, sym) +#define ASSYM_OFFSET(sym, s, m) ASSYM(sym, offsetof(s, m)) #endif /* !_SYS_ASSYM_H_ */ |