Skip to content

Commit ef74ea0

Browse files
authored
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.
1 parent efcdcd7 commit ef74ea0

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

ext/com_dotnet/com_handlers.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
307307
f.type = ZEND_INTERNAL_FUNCTION;
308308
f.num_args = 0;
309309
f.arg_info = NULL;
310-
f.scope = obj->ce;
310+
f.scope = obj->zo.ce;
311311
f.fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
312312
f.function_name = zend_string_copy(name);
313313
f.handler = PHP_FN(com_method_handler);
@@ -392,7 +392,7 @@ static zend_string* com_class_name_get(const zend_object *object)
392392
{
393393
php_com_dotnet_object *obj = (php_com_dotnet_object *)object;
394394

395-
return zend_string_copy(obj->ce->name);
395+
return zend_string_copy(obj->zo.ce->name);
396396
}
397397

398398
/* This compares two variants for equality */
@@ -625,7 +625,6 @@ zend_object* php_com_object_new(zend_class_entry *ce)
625625

626626
VariantInit(&obj->v);
627627
obj->code_page = CP_ACP;
628-
obj->ce = ce;
629628

630629
zend_object_std_init(&obj->zo, ce);
631630

ext/com_dotnet/com_misc.c

-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ PHP_COM_DOTNET_API void php_com_wrap_dispatch(zval *z, IDispatch *disp,
5050
obj = emalloc(sizeof(*obj));
5151
memset(obj, 0, sizeof(*obj));
5252
obj->code_page = codepage;
53-
obj->ce = php_com_variant_class_entry;
54-
obj->zo.ce = php_com_variant_class_entry;
5553

5654
VariantInit(&obj->v);
5755
V_VT(&obj->v) = VT_DISPATCH;
@@ -72,8 +70,6 @@ PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
7270
obj = emalloc(sizeof(*obj));
7371
memset(obj, 0, sizeof(*obj));
7472
obj->code_page = codepage;
75-
obj->ce = php_com_variant_class_entry;
76-
obj->zo.ce = php_com_variant_class_entry;
7773

7874
VariantInit(&obj->v);
7975
VariantCopyInd(&obj->v, v);

ext/com_dotnet/php_com_dotnet_internal.h

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ typedef struct _php_com_dotnet_object {
3535

3636
ITypeInfo *typeinfo;
3737

38-
zend_class_entry *ce;
39-
4038
/* associated event sink */
4139
IDispatch *sink_dispatch;
4240
GUID sink_id;

0 commit comments

Comments
 (0)