]> granicus.if.org Git - php/commitdiff
#ifdef new functions and use their bodies to make PECL extensions compile with PHP...
authorAntony Dovgal <tony2001@php.net>
Mon, 3 Apr 2006 14:59:30 +0000 (14:59 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 3 Apr 2006 14:59:30 +0000 (14:59 +0000)
(as was agreed with Ilia)

ext/simplexml/simplexml.c
ext/tidy/tidy.c
ext/xmlreader/php_xmlreader.c
ext/xmlwriter/php_xmlwriter.c

index 42a365a05c6afafc00656556f25d79b7531b9ce3..69cc4a6b58de3b3f7765a8b7132cbb61b05b3967 100644 (file)
@@ -1785,8 +1785,20 @@ static void sxe_object_free_storage(void *object TSRMLS_DC)
 
        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 @@ static php_sxe_object* php_sxe_object_new(zend_class_entry *ce TSRMLS_DC)
        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;
 }
index 81e8e0b06954d5c704fa0753fbe00838a75a3afd..43327bdaba442d323ef89382a0e591f38e34be97 100644 (file)
@@ -530,7 +530,19 @@ static void tidy_object_free_storage(void *object TSRMLS_DC)
 {
        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 @@ static void tidy_object_new(zend_class_entry *class_type, zend_object_handlers *
 
        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) {
index ca773dd03a084672272f02c050f230aed7252c4d..276865354333fd044303ef6218aa385309b06133 100644 (file)
@@ -377,8 +377,20 @@ void xmlreader_objects_free_storage(void *object TSRMLS_DC)
 {
        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 @@ zend_object_value xmlreader_objects_new(zend_class_entry *class_type TSRMLS_DC)
        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;
index 05fc571febe435aaba7d50bff475197d83189f36..e204fcbb39978da0eb6fea965553d5e6f36b14d7 100644 (file)
@@ -77,8 +77,21 @@ static void xmlwriter_object_free_storage(void *object TSRMLS_DC)
                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 @@ PHP_XMLWRITER_API zend_object_value xmlwriter_object_new(zend_class_entry *class
        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 *));