]> granicus.if.org Git - php/commitdiff
Assume offsetof() exists
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 30 Jun 2020 12:39:49 +0000 (14:39 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 30 Jun 2020 13:55:50 +0000 (15:55 +0200)
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.

Zend/zend_portability.h

index 631ebb29f24dbfe1ee41344d8b6efedc6b3867a2..b94ed7b55f98259595bd5f464531f39a62bd7441 100644 (file)
@@ -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)