diff options
author | Antony Dovgal <tony2001@php.net> | 2006-04-03 14:59:30 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-04-03 14:59:30 +0000 |
commit | 0f510a6a9543988e690f54cb32744157a0f48bf1 (patch) | |
tree | 59d089344e0843a719f73238330fee56c36bc628 /ext/tidy/tidy.c | |
parent | 3edb5a8b6d5353d3d4fc4d69206832d79966c8ad (diff) | |
download | php-git-0f510a6a9543988e690f54cb32744157a0f48bf1.tar.gz |
#ifdef new functions and use their bodies to make PECL extensions compile with PHP < 5.1.3
(as was agreed with Ilia)
Diffstat (limited to 'ext/tidy/tidy.c')
-rw-r--r-- | ext/tidy/tidy.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 81e8e0b069..43327bdaba 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -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) { |