[php-src] PR #21903: zend_portability: Add `ZEND_CONTAINER_OF()`
| From: | TimWolla | Date: | Tue, 28 Apr 2026 20:48:43 +0000 |
| Subject: | [php-src] PR #21903: zend_portability: Add `ZEND_CONTAINER_OF()` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35930@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21903
Author: TimWolla
Changes made with Coccinelle:
@@
type T_container;
identifier member;
expression e;
@@
- (T_container *)(((char *)(e)) - offsetof(T_container, member))
+ ZEND_CONTAINER_OF(e, T_container, member)
@@
type T_container;
identifier member;
expression e;
typedef uintptr_t;
@@
- (T_container *)(((uintptr_t)(e)) - offsetof(T_container, member))
+ ZEND_CONTAINER_OF(e, T_container, member)
@@
type T_container;
identifier member;
expression e;
@@
- (const T_container *)(((char *)(e)) - offsetof(T_container, member))
+ ZEND_CONTAINER_OF(e, T_container, member)
@@
type T_container;
identifier member;
expression e;
typedef uintptr_t;
@@
- (const T_container *)(((uintptr_t)(e)) - offsetof(T_container, member))
+ ZEND_CONTAINER_OF(e, T_container, member)