mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Assume offsetof() exists
This is a standard C macro. Define XtOffsetOf as an alias for compatibility, as this is the name we use in most code right now.
This commit is contained in:
parent
6838ebb1a8
commit
917e28d77e
1 changed files with 0 additions and 21 deletions
|
@ -329,28 +329,7 @@ char *alloca();
|
|||
#endif
|
||||
|
||||
#ifndef XtOffsetOf
|
||||
# if defined(CRAY) || (defined(__ARMCC_VERSION) && !defined(LINUX))
|
||||
# ifdef __STDC__
|
||||
# define XtOffset(p_type, field) _Offsetof(p_type, field)
|
||||
# else
|
||||
# ifdef CRAY2
|
||||
# define XtOffset(p_type, field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
# else /* !CRAY2 */
|
||||
# define XtOffset(p_type, field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
# endif /* !CRAY2 */
|
||||
# endif /* __STDC__ */
|
||||
# else /* ! (CRAY || __arm) */
|
||||
# define XtOffset(p_type, field) \
|
||||
((zend_long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
# endif /* !CRAY */
|
||||
|
||||
# ifdef offsetof
|
||||
# define XtOffsetOf(s_type, field) offsetof(s_type, field)
|
||||
# else
|
||||
# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(HAVE_ALLOCA) || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue