diff options
author | Marcus Boerger <helly@php.net> | 2003-08-24 17:32:47 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-08-24 17:32:47 +0000 |
commit | 19ec7a09fc332d1430bd1488861ef72cb227fca6 (patch) | |
tree | 4daef239378b7fc77c1e0bc952aea7c77dc04dc6 /Zend/zend_variables.c | |
parent | cec053f70763e9974b48836e37adcc03a8f052b6 (diff) | |
download | php-git-19ec7a09fc332d1430bd1488861ef72cb227fca6.tar.gz |
- Provide appropriate way to destroy internal zval's.
- Allow internal zval's of type string and disallow complex types.
- Define the default string for extensions at class level instead of ctor.
Diffstat (limited to 'Zend/zend_variables.c')
-rw-r--r-- | Zend/zend_variables.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index a3de3627a5..12480d9491 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -80,6 +80,32 @@ ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) } +ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) +{ + switch (zvalue->type & ~IS_CONSTANT_INDEX) { + case IS_STRING: + case IS_CONSTANT: + CHECK_ZVAL_STRING_REL(zvalue); + if (zvalue->value.str.val != empty_string) { + free(zvalue->value.str.val); + } + break; + case IS_ARRAY: + case IS_CONSTANT_ARRAY: + case IS_OBJECT: + case IS_RESOURCE: + zend_error(E_CORE_ERROR, "Internal zval's can't be arrays, objects or resources"); + break; + case IS_LONG: + case IS_DOUBLE: + case IS_BOOL: + case IS_NULL: + default: + break; + } +} + + ZEND_API void zval_add_ref(zval **p) { (*p)->refcount++; @@ -159,11 +185,22 @@ ZEND_API void _zval_dtor_wrapper(zval *zvalue) } +ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue) +{ + zval_internal_dtor(zvalue); +} + ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr) { zval_ptr_dtor(zval_ptr); } + + +ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zval_ptr) +{ + zval_internal_ptr_dtor(zval_ptr); +} #endif /* |