From a1abc692d3d0f6721c878619b4aed2a6792edbde Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 2 Apr 2021 07:58:08 +1300 Subject: [PATCH] Eliminate per-class dtor function These are all the same, and the NULL check performed is done inside zend_objects_destroy_object() anyway, so we can just set the dtor to zend_objects_destroy_object (which is what in-tree PHP extensions do.) --- Source/Modules/php.cxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index d35dd7f8d..34886077d 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -133,11 +133,6 @@ static void print_creation_free_wrapper(Node *n) { Printf(s, "/* class object handlers for %s */\n",class_name); Printf(s, "zend_object_handlers %s_object_handlers;\n\n",class_name); - Printf(s, "/* dtor Method for class %s */\n",class_name); - Printf(s, "void %s_destroy_object(zend_object *object) {\n",class_name); - Printf(s, " if(!object)\n\t return;\n"); - Printf(s, " zend_objects_destroy_object(object);\n}\n\n\n"); - Printf(s, "/* Garbage Collection Method for class %s */\n",class_name); Printf(s, "void %s_free_storage(zend_object *object) {\n",class_name); Printf(s, " swig_object_wrapper *obj = 0;\n\n"); @@ -159,7 +154,7 @@ static void print_creation_free_wrapper(Node *n) { Printf(s, " object_properties_init(&obj->std, ce);\n"); Printf(s, " %s_object_handlers.offset = XtOffsetOf(swig_object_wrapper, std);\n",class_name); Printf(s, " %s_object_handlers.free_obj = %s_free_storage;\n",class_name,class_name); - Printf(s, " %s_object_handlers.dtor_obj = %s_destroy_object;\n",class_name,class_name); + Printf(s, " %s_object_handlers.dtor_obj = zend_objects_destroy_object;\n",class_name); Printf(s, " obj->std.handlers = &%s_object_handlers;\n obj->newobject = 1;\n return &obj->std;\n}\n\n\n",class_name); }