summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2004-09-26 20:03:54 +0000
committerAndi Gutmans <andi@php.net>2004-09-26 20:03:54 +0000
commitf17aa81edc3aac9b80607bbaecc3c006dd52b4ae (patch)
treebcef73662f0cb9d5e58ef76283d8107c7e1d54d5
parentd5bac133ee87aac7f5a09a33aa1b409b52a42657 (diff)
downloadphp-git-f17aa81edc3aac9b80607bbaecc3c006dd52b4ae.tar.gz
- Apply Thies and Sterling's patch which doesn't call ctor/dtor functions
- for types which don't require it (BOOL/NULL/LONG/DOUBLE) - Breaks serialization!!!
-rw-r--r--Zend/zend.h5
-rw-r--r--Zend/zend_variables.c7
-rw-r--r--Zend/zend_variables.h25
3 files changed, 27 insertions, 10 deletions
diff --git a/Zend/zend.h b/Zend/zend.h
index b61cf234c5..f4b6ae6e94 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -386,13 +386,14 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
/* data types */
+/* All data types <= IS_BOOL have their constructor/destructors skipped */
#define IS_NULL 0
#define IS_LONG 1
#define IS_DOUBLE 2
-#define IS_STRING 3
+#define IS_BOOL 3
#define IS_ARRAY 4
#define IS_OBJECT 5
-#define IS_BOOL 6
+#define IS_STRING 6
#define IS_RESOURCE 7
#define IS_CONSTANT 8
#define IS_CONSTANT_ARRAY 9
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index f147136a4d..8d6b247be5 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -27,11 +27,8 @@
#include "zend_list.h"
-ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
+ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
- if (zvalue->type==IS_LONG) {
- return;
- }
switch (zvalue->type & ~IS_CONSTANT_INDEX) {
case IS_STRING:
case IS_CONSTANT:
@@ -104,7 +101,7 @@ ZEND_API void zval_add_ref(zval **p)
}
-ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
+ZEND_API int _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
switch (zvalue->type) {
case IS_RESOURCE: {
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
index 10939b932f..8cdf76e639 100644
--- a/Zend/zend_variables.h
+++ b/Zend/zend_variables.h
@@ -23,11 +23,30 @@
#define ZEND_VARIABLES_H
-
BEGIN_EXTERN_C()
+
+ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC);
+
+static inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
+{
+ if (zvalue->type <= IS_BOOL) {
+ return;
+ }
+ _zval_dtor_func(zvalue ZEND_FILE_LINE_CC);
+}
+
+ZEND_API int _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
+
+static inline int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
+{
+ if (zvalue->type <= IS_BOOL) {
+ return;
+ }
+ _zval_copy_ctor_func(zvalue ZEND_FILE_LINE_CC);
+}
+
+
ZEND_API int zend_print_variable(zval *var);
-ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC);
-ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC);
ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC);
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC);
ZEND_API void _zval_internal_ptr_dtor(zval **zvalue ZEND_FILE_LINE_DC);