Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
and ZEND_PARSE_PARAMS_THROW have been removed due to being misleading,
since ZPP always throws, unless ZEND_PARSE_PARAMS_QUIET is given. Use
the non-throw versions.
. The XtOffsetOf() alias of C’s offsetof() macro has been removed. Use
offsetof() directly.

========================
2. Build system changes
Expand Down
4 changes: 2 additions & 2 deletions Zend/Optimizer/zend_optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ static bool zend_optimizer_ignore_class(zval *ce_zv, const zend_string *filename
if (CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE) {
return true;
}
const Bucket *ce_bucket = (const Bucket*)((uintptr_t)ce_zv - XtOffsetOf(Bucket, val));
const Bucket *ce_bucket = (const Bucket*)((uintptr_t)ce_zv - offsetof(Bucket, val));
size_t offset = ce_bucket - EG(class_table)->arData;
if (offset < EG(persistent_classes_count)) {
return false;
Expand All @@ -801,7 +801,7 @@ static bool zend_optimizer_ignore_function(zval *fbc_zv, const zend_string *file
if (CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE) {
return true;
}
const Bucket *fbc_bucket = (const Bucket*)((uintptr_t)fbc_zv - XtOffsetOf(Bucket, val));
const Bucket *fbc_bucket = (const Bucket*)((uintptr_t)fbc_zv - offsetof(Bucket, val));
size_t offset = fbc_bucket - EG(function_table)->arData;
if (offset < EG(persistent_functions_count)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ typedef void (*zend_ast_apply_func)(zend_ast **ast_ptr, void *context);
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *context);

static zend_always_inline size_t zend_ast_size(uint32_t children) {
return XtOffsetOf(zend_ast, child) + (sizeof(zend_ast *) * children);
return offsetof(zend_ast, child) + (sizeof(zend_ast *) * children);
}

static zend_always_inline bool zend_ast_is_special(const zend_ast *ast) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ static void zend_create_closure_ex(zval *res, zend_function *func, zend_class_en
/* wrap internal function handler to avoid memory leak */
if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) {
/* avoid infinity recursion, by taking handler from nested closure */
zend_closure *nested = (zend_closure*)((char*)func - XtOffsetOf(zend_closure, func));
zend_closure *nested = (zend_closure*)((char*)func - offsetof(zend_closure, func));
ZEND_ASSERT(nested->std.ce == zend_ce_closure);
closure->orig_internal_handler = nested->orig_internal_handler;
} else {
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5175,7 +5175,7 @@ static zend_result zend_compile_func_array_map(znode *result, zend_ast_list *arg
opline->lineno = lineno;
opline->extended_value = (2 << 16) | IS_ARRAY;
const zval *fbc_zv = zend_hash_find(CG(function_table), lcname);
const Bucket *fbc_bucket = (const Bucket*)((uintptr_t)fbc_zv - XtOffsetOf(Bucket, val));
const Bucket *fbc_bucket = (const Bucket*)((uintptr_t)fbc_zv - offsetof(Bucket, val));
Z_EXTRA_P(CT_CONSTANT(opline->op1)) = fbc_bucket - CG(function_table)->arData;

/* Initialize the result array. */
Expand Down Expand Up @@ -5472,7 +5472,7 @@ static void zend_compile_call(znode *result, const zend_ast *ast, uint32_t type)

/* Store offset to function from symbol table in op2.extra. */
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
const Bucket *fbc_bucket = (const Bucket*)((uintptr_t)fbc_zv - XtOffsetOf(Bucket, val));
const Bucket *fbc_bucket = (const Bucket*)((uintptr_t)fbc_zv - offsetof(Bucket, val));
Z_EXTRA_P(CT_CONSTANT(opline->op2)) = fbc_bucket - CG(function_table)->arData;
}

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ typedef struct _zend_property_info {
#define OBJ_PROP_NUM(obj, num) \
(&(obj)->properties_table[(num)])
#define OBJ_PROP_TO_OFFSET(num) \
((uint32_t)(XtOffsetOf(zend_object, properties_table) + sizeof(zval) * (num)))
((uint32_t)(offsetof(zend_object, properties_table) + sizeof(zval) * (num)))
#define OBJ_PROP_TO_NUM(offset) \
(((offset) - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))
#define OBJ_PROP_SLOT_TO_OFFSET(obj, slot) \
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void zend_register_enum_ce(void)
zend_ce_backed_enum->interface_gets_implemented = zend_implement_backed_enum;

memcpy(&zend_enum_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
zend_enum_object_handlers.offset = XtOffsetOf(zend_enum_obj, std);
zend_enum_object_handlers.offset = offsetof(zend_enum_obj, std);
zend_enum_object_handlers.clone_obj = NULL;
zend_enum_object_handlers.compare = zend_objects_not_comparable;
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct zend_enum_obj {

static inline zend_enum_obj *zend_enum_obj_from_obj(zend_object *zobj) {
ZEND_ASSERT(zobj->ce->ce_flags & ZEND_ACC_ENUM);
return (zend_enum_obj*)((char*)(zobj) - XtOffsetOf(zend_enum_obj, std));
return (zend_enum_obj*)((char*)(zobj) - offsetof(zend_enum_obj, std));
}

void zend_enum_startup(void);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_fibers.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static zend_always_inline zend_fiber *zend_fiber_from_context(zend_fiber_context
{
ZEND_ASSERT(context->kind == zend_ce_fiber && "Fiber context does not belong to a Zend fiber");

return (zend_fiber *)(((char *) context) - XtOffsetOf(zend_fiber, context));
return (zend_fiber *)(((char *) context) - offsetof(zend_fiber, context));
}

static zend_always_inline zend_fiber_context *zend_fiber_get_context(zend_fiber *fiber)
Expand Down
12 changes: 6 additions & 6 deletions Zend/zend_ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ END_EXTERN_C()

#ifdef ZTS
#define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr##_id)
#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr, displayer) \
ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
#else
#define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr)
#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr, displayer) \
ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr, displayer)
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
#endif

#define REGISTER_INI_ENTRIES() zend_register_ini_entries_ex(ini_entries, module_number, type)
Expand Down
4 changes: 0 additions & 4 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,6 @@ char *alloca();
# define UNEXPECTED(condition) (condition)
#endif

#ifndef XtOffsetOf
# define XtOffsetOf(s_type, field) offsetof(s_type, field)
#endif

#ifndef ZEND_WIN32
# define SETJMP(a) sigsetjmp(a, 0)
# define LONGJMP(a,b) siglongjmp(a, b)
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static zend_always_inline zend_string *ZSTR_KNOWN(size_t idx) {
return zend_known_strings[idx];
}

#define _ZSTR_HEADER_SIZE XtOffsetOf(zend_string, val)
#define _ZSTR_HEADER_SIZE offsetof(zend_string, val)

#define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1)

Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_weakrefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ static zend_class_entry *zend_ce_weakmap;
static zend_object_handlers zend_weakref_handlers;
static zend_object_handlers zend_weakmap_handlers;

#define zend_weakref_from(o) ((zend_weakref*)(((char*) o) - XtOffsetOf(zend_weakref, std)))
#define zend_weakref_from(o) ((zend_weakref*)(((char*) o) - offsetof(zend_weakref, std)))
#define zend_weakref_fetch(z) zend_weakref_from(Z_OBJ_P(z))

#define zend_weakmap_from(o) ((zend_weakmap*)(((char*) o) - XtOffsetOf(zend_weakmap, std)))
#define zend_weakmap_from(o) ((zend_weakmap*)(((char*) o) - offsetof(zend_weakmap, std)))
#define zend_weakmap_fetch(z) zend_weakmap_from(Z_OBJ_P(z))

static inline void zend_weakref_unref_single(
Expand Down Expand Up @@ -796,7 +796,7 @@ void zend_register_weakref_ce(void) /* {{{ */
zend_ce_weakref->default_object_handlers = &zend_weakref_handlers;

memcpy(&zend_weakref_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
zend_weakref_handlers.offset = XtOffsetOf(zend_weakref, std);
zend_weakref_handlers.offset = offsetof(zend_weakref, std);

zend_weakref_handlers.free_obj = zend_weakref_free;
zend_weakref_handlers.get_debug_info = zend_weakref_get_debug_info;
Expand All @@ -809,7 +809,7 @@ void zend_register_weakref_ce(void) /* {{{ */
zend_ce_weakmap->default_object_handlers = &zend_weakmap_handlers;

memcpy(&zend_weakmap_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
zend_weakmap_handlers.offset = XtOffsetOf(zend_weakmap, std);
zend_weakmap_handlers.offset = offsetof(zend_weakmap, std);
zend_weakmap_handlers.free_obj = zend_weakmap_free_obj;
zend_weakmap_handlers.read_dimension = zend_weakmap_read_dimension;
zend_weakmap_handlers.write_dimension = zend_weakmap_write_dimension;
Expand Down
4 changes: 2 additions & 2 deletions ext/bcmath/bcmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ static int bcmath_number_compare(zval *op1, zval *op2);

static zend_always_inline bcmath_number_obj_t *get_bcmath_number_from_obj(const zend_object *obj)
{
return (bcmath_number_obj_t*)((char*)(obj) - XtOffsetOf(bcmath_number_obj_t, std));
return (bcmath_number_obj_t*)((char*)(obj) - offsetof(bcmath_number_obj_t, std));
}

static zend_always_inline bcmath_number_obj_t *get_bcmath_number_from_zval(const zval *zv)
Expand Down Expand Up @@ -1024,7 +1024,7 @@ static void bcmath_number_register_class(void)
bcmath_number_ce->default_object_handlers = &bcmath_number_obj_handlers;

memcpy(&bcmath_number_obj_handlers, &std_object_handlers, sizeof(zend_object_handlers));
bcmath_number_obj_handlers.offset = XtOffsetOf(bcmath_number_obj_t, std);
bcmath_number_obj_handlers.offset = offsetof(bcmath_number_obj_t, std);
bcmath_number_obj_handlers.free_obj = bcmath_number_free;
bcmath_number_obj_handlers.clone_obj = bcmath_number_clone;
bcmath_number_obj_handlers.do_operation = bcmath_number_do_operation;
Expand Down
4 changes: 2 additions & 2 deletions ext/curl/curl_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source);
zend_long php_curl_get_long(zval *zv);

static inline php_curl *curl_from_obj(zend_object *obj) {
return (php_curl *)((char *)(obj) - XtOffsetOf(php_curl, std));
return (php_curl *)((char *)(obj) - offsetof(php_curl, std));
}

#define Z_CURL_P(zv) curl_from_obj(Z_OBJ_P(zv))

static inline php_curlsh *curl_share_from_obj(zend_object *obj) {
return (php_curlsh *)((char *)(obj) - XtOffsetOf(php_curlsh, std));
return (php_curlsh *)((char *)(obj) - offsetof(php_curlsh, std));
}

#define Z_CURL_SHARE_P(zv) curl_share_from_obj(Z_OBJ_P(zv))
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ PHP_MINIT_FUNCTION(curl)
curl_ce->default_object_handlers = &curl_object_handlers;

memcpy(&curl_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
curl_object_handlers.offset = XtOffsetOf(php_curl, std);
curl_object_handlers.offset = offsetof(php_curl, std);
curl_object_handlers.free_obj = curl_free_obj;
curl_object_handlers.get_gc = curl_get_gc;
curl_object_handlers.get_constructor = curl_get_constructor;
Expand Down
4 changes: 2 additions & 2 deletions ext/curl/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
zend_class_entry *curl_multi_ce;

static inline php_curlm *curl_multi_from_obj(zend_object *obj) {
return (php_curlm *)((char *)(obj) - XtOffsetOf(php_curlm, std));
return (php_curlm *)((char *)(obj) - offsetof(php_curlm, std));
}

#define Z_CURL_MULTI_P(zv) curl_multi_from_obj(Z_OBJ_P(zv))
Expand Down Expand Up @@ -605,7 +605,7 @@ void curl_multi_register_handlers(void) {
curl_multi_ce->default_object_handlers = &curl_multi_handlers;

memcpy(&curl_multi_handlers, &std_object_handlers, sizeof(zend_object_handlers));
curl_multi_handlers.offset = XtOffsetOf(php_curlm, std);
curl_multi_handlers.offset = offsetof(php_curlm, std);
curl_multi_handlers.free_obj = curl_multi_free_obj;
curl_multi_handlers.get_gc = curl_multi_get_gc;
curl_multi_handlers.get_constructor = curl_multi_get_constructor;
Expand Down
4 changes: 2 additions & 2 deletions ext/curl/share.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void curl_share_register_handlers(void) {
curl_share_ce->default_object_handlers = &curl_share_handlers;

memcpy(&curl_share_handlers, &std_object_handlers, sizeof(zend_object_handlers));
curl_share_handlers.offset = XtOffsetOf(php_curlsh, std);
curl_share_handlers.offset = offsetof(php_curlsh, std);
curl_share_handlers.free_obj = curl_share_free_obj;
curl_share_handlers.get_constructor = curl_share_get_constructor;
curl_share_handlers.clone_obj = NULL;
Expand All @@ -324,7 +324,7 @@ void curl_share_persistent_register_handlers(void) {
curl_share_persistent_ce->default_object_handlers = &curl_share_persistent_handlers;

memcpy(&curl_share_persistent_handlers, &std_object_handlers, sizeof(zend_object_handlers));
curl_share_persistent_handlers.offset = XtOffsetOf(php_curlsh, std);
curl_share_persistent_handlers.offset = offsetof(php_curlsh, std);
curl_share_persistent_handlers.get_constructor = curl_share_persistent_get_constructor;
curl_share_persistent_handlers.clone_obj = NULL;
curl_share_persistent_handlers.compare = zend_objects_not_comparable;
Expand Down
8 changes: 4 additions & 4 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ static void date_register_classes(void) /* {{{ */
date_ce_date->create_object = date_object_new_date;
date_ce_date->default_object_handlers = &date_object_handlers_date;
memcpy(&date_object_handlers_date, &std_object_handlers, sizeof(zend_object_handlers));
date_object_handlers_date.offset = XtOffsetOf(php_date_obj, std);
date_object_handlers_date.offset = offsetof(php_date_obj, std);
date_object_handlers_date.free_obj = date_object_free_storage_date;
date_object_handlers_date.clone_obj = date_object_clone_date;
date_object_handlers_date.compare = date_object_compare_date;
Expand All @@ -1774,7 +1774,7 @@ static void date_register_classes(void) /* {{{ */
date_ce_timezone->create_object = date_object_new_timezone;
date_ce_timezone->default_object_handlers = &date_object_handlers_timezone;
memcpy(&date_object_handlers_timezone, &std_object_handlers, sizeof(zend_object_handlers));
date_object_handlers_timezone.offset = XtOffsetOf(php_timezone_obj, std);
date_object_handlers_timezone.offset = offsetof(php_timezone_obj, std);
date_object_handlers_timezone.free_obj = date_object_free_storage_timezone;
date_object_handlers_timezone.clone_obj = date_object_clone_timezone;
date_object_handlers_timezone.get_properties_for = date_object_get_properties_for_timezone;
Expand All @@ -1786,7 +1786,7 @@ static void date_register_classes(void) /* {{{ */
date_ce_interval->create_object = date_object_new_interval;
date_ce_interval->default_object_handlers = &date_object_handlers_interval;
memcpy(&date_object_handlers_interval, &std_object_handlers, sizeof(zend_object_handlers));
date_object_handlers_interval.offset = XtOffsetOf(php_interval_obj, std);
date_object_handlers_interval.offset = offsetof(php_interval_obj, std);
date_object_handlers_interval.free_obj = date_object_free_storage_interval;
date_object_handlers_interval.clone_obj = date_object_clone_interval;
date_object_handlers_interval.has_property = date_interval_has_property;
Expand All @@ -1802,7 +1802,7 @@ static void date_register_classes(void) /* {{{ */
date_ce_period->default_object_handlers = &date_object_handlers_period;
date_ce_period->get_iterator = date_object_period_get_iterator;
memcpy(&date_object_handlers_period, &std_object_handlers, sizeof(zend_object_handlers));
date_object_handlers_period.offset = XtOffsetOf(php_period_obj, std);
date_object_handlers_period.offset = offsetof(php_period_obj, std);
date_object_handlers_period.free_obj = date_object_free_storage_period;
date_object_handlers_period.clone_obj = date_object_clone_period;
date_object_handlers_period.get_gc = date_object_get_gc_period;
Expand Down
8 changes: 4 additions & 4 deletions ext/date/php_date.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct _php_date_obj {
};

static inline php_date_obj *php_date_obj_from_obj(zend_object *obj) {
return (php_date_obj*)((char*)(obj) - XtOffsetOf(php_date_obj, std));
return (php_date_obj*)((char*)(obj) - offsetof(php_date_obj, std));
}

#define Z_PHPDATE_P(zv) php_date_obj_from_obj(Z_OBJ_P((zv)))
Expand All @@ -76,7 +76,7 @@ struct _php_timezone_obj {
};

static inline php_timezone_obj *php_timezone_obj_from_obj(zend_object *obj) {
return (php_timezone_obj*)((char*)(obj) - XtOffsetOf(php_timezone_obj, std));
return (php_timezone_obj*)((char*)(obj) - offsetof(php_timezone_obj, std));
}

#define Z_PHPTIMEZONE_P(zv) php_timezone_obj_from_obj(Z_OBJ_P((zv)))
Expand All @@ -94,7 +94,7 @@ struct _php_interval_obj {
};

static inline php_interval_obj *php_interval_obj_from_obj(zend_object *obj) {
return (php_interval_obj*)((char*)(obj) - XtOffsetOf(php_interval_obj, std));
return (php_interval_obj*)((char*)(obj) - offsetof(php_interval_obj, std));
}

#define Z_PHPINTERVAL_P(zv) php_interval_obj_from_obj(Z_OBJ_P((zv)))
Expand All @@ -113,7 +113,7 @@ struct _php_period_obj {
};

static inline php_period_obj *php_period_obj_from_obj(zend_object *obj) {
return (php_period_obj*)((char*)(obj) - XtOffsetOf(php_period_obj, std));
return (php_period_obj*)((char*)(obj) - offsetof(php_period_obj, std));
}

#define Z_PHPPERIOD_P(zv) php_period_obj_from_obj(Z_OBJ_P((zv)))
Expand Down
4 changes: 2 additions & 2 deletions ext/dba/dba.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ static zend_result dba_connection_cast_object(zend_object *obj, zval *result, in

static inline dba_connection *dba_connection_from_obj(zend_object *obj)
{
return (dba_connection *)((char *)(obj) - XtOffsetOf(dba_connection, std));
return (dba_connection *)((char *)(obj) - offsetof(dba_connection, std));
}

#define Z_DBA_CONNECTION_P(zv) dba_connection_from_obj(Z_OBJ_P(zv))
Expand Down Expand Up @@ -409,7 +409,7 @@ PHP_MINIT_FUNCTION(dba)
dba_connection_ce->default_object_handlers = &dba_connection_object_handlers;

memcpy(&dba_connection_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
dba_connection_object_handlers.offset = XtOffsetOf(dba_connection, std);
dba_connection_object_handlers.offset = offsetof(dba_connection, std);
dba_connection_object_handlers.free_obj = dba_connection_free_obj;
dba_connection_object_handlers.get_constructor = dba_connection_get_constructor;
dba_connection_object_handlers.clone_obj = NULL;
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/namespace_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static HashTable *php_dom_libxml_ns_mapper_ensure_prefix_map(php_dom_libxml_ns_m
zend_hash_add_new(&mapper->uri_to_prefix_map, *uri, &zv_prefix_map);
} else {
/* cast to Bucket* only works if this holds, I would prefer a static assert but we're stuck at C99. */
ZEND_ASSERT(XtOffsetOf(Bucket, val) == 0);
ZEND_ASSERT(offsetof(Bucket, val) == 0);
ZEND_ASSERT(Z_TYPE_P(zv) == IS_ARRAY);
Bucket *bucket = (Bucket *) zv;
/* Make sure we take the value from the key string that lives long enough. */
Expand Down
Loading