tony2001 Mon Apr 3 14:59:30 2006 UTC Modified files: (Branch: PHP_5_1) /php-src/ext/tidy tidy.c /php-src/ext/simplexml simplexml.c /php-src/ext/xmlwriter php_xmlwriter.c /php-src/ext/xmlreader php_xmlreader.c Log: #ifdef new functions and use their bodies to make PECL extensions compile with PHP < 5.1.3 (as was agreed with Ilia)
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.66.2.6&r2=1.66.2.7&diff_format=u Index: php-src/ext/tidy/tidy.c diff -u php-src/ext/tidy/tidy.c:1.66.2.6 php-src/ext/tidy/tidy.c:1.66.2.7 --- php-src/ext/tidy/tidy.c:1.66.2.6 Wed Mar 29 14:28:42 2006 +++ php-src/ext/tidy/tidy.c Mon Apr 3 14:59:30 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tidy.c,v 1.66.2.6 2006/03/29 14:28:42 tony2001 Exp $ */ +/* $Id: tidy.c,v 1.66.2.7 2006/04/03 14:59:30 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -530,7 +530,19 @@ { PHPTidyObj *intern = (PHPTidyObj *)object; +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_dtor(&intern->std TSRMLS_CC); +#else + if (intern->std.guards) { + zend_hash_destroy(intern->std.guards); + FREE_HASHTABLE(intern->std.guards); + } + + if (intern->std.properties) { + zend_hash_destroy(intern->std.properties); + FREE_HASHTABLE(intern->std.properties); + } +#endif if (intern->ptdoc) { intern->ptdoc->ref_count--; @@ -554,8 +566,16 @@ intern = emalloc(sizeof(PHPTidyObj)); memset(intern, 0, sizeof(PHPTidyObj)); - +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_init(&intern->std, class_type TSRMLS_CC); +#else + ALLOC_HASHTABLE(intern->std.properties); + zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + + intern->std.ce = class_type; + intern->std.guards = NULL; +#endif + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); switch(objtype) { @@ -980,7 +1000,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Tidy support", "enabled"); php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate()); - php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.6 2006/03/29 14:28:42 tony2001 Exp $)"); + php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.7 2006/04/03 14:59:30 tony2001 Exp $)"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.19&r2=1.151.2.20&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.151.2.19 php-src/ext/simplexml/simplexml.c:1.151.2.20 --- php-src/ext/simplexml/simplexml.c:1.151.2.19 Wed Mar 29 14:28:42 2006 +++ php-src/ext/simplexml/simplexml.c Mon Apr 3 14:59:30 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.151.2.19 2006/03/29 14:28:42 tony2001 Exp $ */ +/* $Id: simplexml.c,v 1.151.2.20 2006/04/03 14:59:30 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1785,8 +1785,20 @@ sxe = (php_sxe_object *) object; +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_dtor(&sxe->zo TSRMLS_CC); - +#else + if (sxe->zo.guards) { + zend_hash_destroy(sxe->zo.guards); + FREE_HASHTABLE(sxe->zo.guards); + } + + if (sxe->zo.properties) { + zend_hash_destroy(sxe->zo.properties); + FREE_HASHTABLE(sxe->zo.properties); + } +#endif + php_libxml_node_decrement_resource((php_libxml_node_object *)sxe TSRMLS_CC); if (sxe->xpath) { @@ -1814,7 +1826,15 @@ intern->iter.nsprefix = NULL; intern->iter.name = NULL; +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_init(&intern->zo, ce TSRMLS_CC); +#else + ALLOC_HASHTABLE(intern->zo.properties); + zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + + intern->zo.ce = ce; + intern->zo.guards = NULL; +#endif return intern; } @@ -2287,7 +2307,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.19 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.20 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewcvs.cgi/php-src/ext/xmlwriter/php_xmlwriter.c?r1=1.20.2.11&r2=1.20.2.12&diff_format=u Index: php-src/ext/xmlwriter/php_xmlwriter.c diff -u php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.11 php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.12 --- php-src/ext/xmlwriter/php_xmlwriter.c:1.20.2.11 Wed Mar 29 14:28:43 2006 +++ php-src/ext/xmlwriter/php_xmlwriter.c Mon Apr 3 14:59:30 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_xmlwriter.c,v 1.20.2.11 2006/03/29 14:28:43 tony2001 Exp $ */ +/* $Id: php_xmlwriter.c,v 1.20.2.12 2006/04/03 14:59:30 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -77,8 +77,21 @@ xmlwriter_free_resource_ptr(intern->xmlwriter_ptr TSRMLS_CC); } intern->xmlwriter_ptr = NULL; + +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_dtor(&intern->zo TSRMLS_CC); - +#else + if (intern->zo.guards) { + zend_hash_destroy(intern->zo.guards); + FREE_HASHTABLE(intern->zo.guards); + } + + if (intern->zo.properties) { + zend_hash_destroy(intern->zo.properties); + FREE_HASHTABLE(intern->zo.properties); + } +#endif + efree(intern); } /* }}} */ @@ -94,8 +107,17 @@ intern = emalloc(sizeof(ze_xmlwriter_object)); memset(&intern->zo, 0, sizeof(zend_object)); intern->xmlwriter_ptr = NULL; - + +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_init(&intern->zo, class_type TSRMLS_CC); +#else + ALLOC_HASHTABLE(intern->zo.properties); + zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + + intern->zo.ce = class_type; + intern->zo.guards = NULL; +#endif + zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); http://cvs.php.net/viewcvs.cgi/php-src/ext/xmlreader/php_xmlreader.c?r1=1.13.2.13&r2=1.13.2.14&diff_format=u Index: php-src/ext/xmlreader/php_xmlreader.c diff -u php-src/ext/xmlreader/php_xmlreader.c:1.13.2.13 php-src/ext/xmlreader/php_xmlreader.c:1.13.2.14 --- php-src/ext/xmlreader/php_xmlreader.c:1.13.2.13 Thu Mar 30 17:37:50 2006 +++ php-src/ext/xmlreader/php_xmlreader.c Mon Apr 3 14:59:30 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_xmlreader.c,v 1.13.2.13 2006/03/30 17:37:50 helly Exp $ */ +/* $Id: php_xmlreader.c,v 1.13.2.14 2006/04/03 14:59:30 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -377,8 +377,20 @@ { xmlreader_object *intern = (xmlreader_object *)object; +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_dtor(&intern->std TSRMLS_CC); - +#else + if (intern->std.guards) { + zend_hash_destroy(intern->std.guards); + FREE_HASHTABLE(intern->std.guards); + } + + if (intern->std.properties) { + zend_hash_destroy(intern->std.properties); + FREE_HASHTABLE(intern->std.properties); + } +#endif + xmlreader_free_resources(intern); efree(object); @@ -398,7 +410,16 @@ intern->schema = NULL; intern->prop_handler = &xmlreader_prop_handlers; +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_init(&intern->std, class_type TSRMLS_CC); +#else + ALLOC_HASHTABLE(intern->std.properties); + zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + + intern->std.ce = class_type; + intern->std.guards = NULL; +#endif + zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) xmlreader_objects_free_storage, xmlreader_objects_clone TSRMLS_CC); intern->handle = retval.handle;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php