Skip to content

Commit 95f9ab8

Browse files
andypostnikic
authored andcommitted
Replace XtOffsetOf() with offsetof() for PHP 8.6
PHP 8.6 removed XtOffsetOf(), which was an alias for the standard C offsetof() macro. Replace all usages in apc_cache.h and apc_iterator with offsetof() directly. Ref: php/php-src@7114314
1 parent 3552842 commit 95f9ab8

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

apc_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static inline void apc_cache_runlock(apc_cache_t *cache) {
295295
}
296296

297297
/* APC_ENTRY_SIZE takes into account the trailing key-string + terminating 0-byte */
298-
#define APC_ENTRY_SIZE(key_len) (ZEND_MM_ALIGNED_SIZE(XtOffsetOf(apc_cache_entry_t, key.val) + key_len + 1))
298+
#define APC_ENTRY_SIZE(key_len) (ZEND_MM_ALIGNED_SIZE(offsetof(apc_cache_entry_t, key.val) + key_len + 1))
299299

300300
/* ENTRYAT and ENTRYOF are used to convert between offsets and pointers to cache entries.
301301
* Both expect the presence of cache->header that points to the cache header in the

apc_iterator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ int apc_iterator_init(int module_number) {
548548

549549
apc_iterator_object_handlers.clone_obj = NULL;
550550
apc_iterator_object_handlers.free_obj = apc_iterator_free;
551-
apc_iterator_object_handlers.offset = XtOffsetOf(apc_iterator_t, obj);
551+
apc_iterator_object_handlers.offset = offsetof(apc_iterator_t, obj);
552552

553553
return SUCCESS;
554554
}

apc_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef struct _apc_iterator_t {
6969
zend_object obj;
7070
} apc_iterator_t;
7171

72-
#define apc_iterator_fetch_from(o) ((apc_iterator_t*)((char*)o - XtOffsetOf(apc_iterator_t, obj)))
72+
#define apc_iterator_fetch_from(o) ((apc_iterator_t*)((char*)o - offsetof(apc_iterator_t, obj)))
7373
#define apc_iterator_fetch(z) apc_iterator_fetch_from(Z_OBJ_P(z))
7474

7575
typedef struct _apc_iterator_item_t {

0 commit comments

Comments
 (0)