From ef74ea08cea556e8ce0e03eac74a1266c8dec1e7 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 27 Jan 2025 20:26:57 +0100 Subject: [PATCH] Drop superfluous php_com_dotnet_object.ce (GH-17603) * Drop superfluous php_com_dotnet_object.ce This is readily available via the `zend_object` (i.e. `zo.ce`), so there is no need to duplicate it. There is also no need to assign the ce to the std object, since this is done be `zend_object_std_init()` anyway. --- ext/com_dotnet/com_handlers.c | 5 ++--- ext/com_dotnet/com_misc.c | 4 ---- ext/com_dotnet/php_com_dotnet_internal.h | 2 -- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index fcbae4e3462..5a177457a44 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -307,7 +307,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name f.type = ZEND_INTERNAL_FUNCTION; f.num_args = 0; f.arg_info = NULL; - f.scope = obj->ce; + f.scope = obj->zo.ce; f.fn_flags = ZEND_ACC_CALL_VIA_HANDLER; f.function_name = zend_string_copy(name); f.handler = PHP_FN(com_method_handler); @@ -392,7 +392,7 @@ static zend_string* com_class_name_get(const zend_object *object) { php_com_dotnet_object *obj = (php_com_dotnet_object *)object; - return zend_string_copy(obj->ce->name); + return zend_string_copy(obj->zo.ce->name); } /* This compares two variants for equality */ @@ -625,7 +625,6 @@ zend_object* php_com_object_new(zend_class_entry *ce) VariantInit(&obj->v); obj->code_page = CP_ACP; - obj->ce = ce; zend_object_std_init(&obj->zo, ce); diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index 3c85fc4ce5e..a5de6415b9a 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -50,8 +50,6 @@ PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp, obj = emalloc(sizeof(*obj)); memset(obj, 0, sizeof(*obj)); obj->code_page = codepage; - obj->ce = php_com_variant_class_entry; - obj->zo.ce = php_com_variant_class_entry; VariantInit(&obj->v); V_VT(&obj->v) = VT_DISPATCH; @@ -72,8 +70,6 @@ PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v, obj = emalloc(sizeof(*obj)); memset(obj, 0, sizeof(*obj)); obj->code_page = codepage; - obj->ce = php_com_variant_class_entry; - obj->zo.ce = php_com_variant_class_entry; VariantInit(&obj->v); VariantCopyInd(&obj->v, v); diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index 90c3ab2d40e..09fe4943934 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -35,8 +35,6 @@ typedef struct _php_com_dotnet_object { ITypeInfo *typeinfo; - zend_class_entry *ce; - /* associated event sink */ IDispatch *sink_dispatch; GUID sink_id;