]> granicus.if.org Git - php/commitdiff
- Apply Thies and Sterling's patch which doesn't call ctor/dtor functions
authorAndi Gutmans <andi@php.net>
Sun, 26 Sep 2004 20:03:54 +0000 (20:03 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 26 Sep 2004 20:03:54 +0000 (20:03 +0000)
- for types which don't require it (BOOL/NULL/LONG/DOUBLE)
- Breaks serialization!!!

Zend/zend.h
Zend/zend_variables.c
Zend/zend_variables.h

index b61cf234c59917020711e85fc660c977279033db..f4b6ae6e94339bccf9eda95840f0a5933404cbf9 100644 (file)
@@ -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
index f147136a4d3dc28b8663c996f416384cc7b077eb..8d6b247be51add186567213f4161d7555cd28050 100644 (file)
 #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: {
index 10939b932f7ce0a3028a5f5cb84555c8d0d8211e..8cdf76e639a257f7a4608a2a6c781f308add27bf 100644 (file)
 #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);