xref: /PHP-5.3/Zend/zend_variables.h (revision 831fbcf3)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 2.00 of the Zend license,     |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.zend.com/license/2_00.txt.                                |
11    | If you did not receive a copy of the Zend license and are unable to  |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@zend.com so we can mail you a copy immediately.              |
14    +----------------------------------------------------------------------+
15    | Authors: Andi Gutmans <andi@zend.com>                                |
16    |          Zeev Suraski <zeev@zend.com>                                |
17    +----------------------------------------------------------------------+
18 */
19 
20 /* $Id$ */
21 
22 #ifndef ZEND_VARIABLES_H
23 #define ZEND_VARIABLES_H
24 
25 
26 BEGIN_EXTERN_C()
27 
28 ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC);
29 
_zval_dtor(zval * zvalue ZEND_FILE_LINE_DC)30 static inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
31 {
32 	if (zvalue->type <= IS_BOOL) {
33 		return;
34 	}
35 	_zval_dtor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
36 }
37 
38 ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
39 
_zval_copy_ctor(zval * zvalue ZEND_FILE_LINE_DC)40 static inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
41 {
42 	if (zvalue->type <= IS_BOOL) {
43 		return;
44 	}
45 	_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
46 }
47 
48 
49 ZEND_API int zend_print_variable(zval *var);
50 ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC);
51 ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC);
52 ZEND_API void _zval_internal_ptr_dtor(zval **zvalue ZEND_FILE_LINE_DC);
53 ZEND_API void _zval_dtor_wrapper(zval *zvalue);
54 #define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC)
55 #define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
56 #define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC)
57 #define zval_internal_dtor(zvalue) _zval_internal_dtor((zvalue) ZEND_FILE_LINE_CC)
58 #define zval_internal_ptr_dtor(zvalue) _zval_internal_ptr_dtor((zvalue) ZEND_FILE_LINE_CC)
59 #define zval_dtor_wrapper _zval_dtor_wrapper
60 
61 #if ZEND_DEBUG
62 ZEND_API void _zval_copy_ctor_wrapper(zval *zvalue);
63 ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr);
64 ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue);
65 ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zvalue);
66 #define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper
67 #define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper
68 #define zval_internal_dtor_wrapper _zval_internal_dtor_wrapper
69 #define zval_internal_ptr_dtor_wrapper _zval_internal_ptr_dtor_wrapper
70 #else
71 #define zval_copy_ctor_wrapper _zval_copy_ctor_func
72 #define zval_ptr_dtor_wrapper _zval_ptr_dtor
73 #define zval_internal_dtor_wrapper _zval_internal_dtor
74 #define zval_internal_ptr_dtor_wrapper _zval_internal_ptr_dtor
75 #endif
76 
77 ZEND_API void zval_add_ref(zval **p);
78 
79 ZEND_API void zval_property_ctor(zval **);
80 
81 #ifdef ZTS
82 # define zval_shared_property_ctor zval_property_ctor
83 #else
84 # define zval_shared_property_ctor zval_add_ref
85 #endif
86 
87 #define zval_copy_property_ctor(ce) ((copy_ctor_func_t) (((ce)->type == ZEND_INTERNAL_CLASS) ? zval_shared_property_ctor : zval_add_ref))
88 
89 
90 END_EXTERN_C()
91 
92 #define ZVAL_DESTRUCTOR (void (*)(void *)) zval_dtor_wrapper
93 #define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper
94 #define ZVAL_INTERNAL_DTOR (void (*)(void *)) zval_internal_dtor_wrapper
95 #define ZVAL_INTERNAL_PTR_DTOR (void (*)(void *)) zval_internal_ptr_dtor_wrapper
96 #define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper
97 
98 #endif
99 
100 /*
101  * Local variables:
102  * tab-width: 4
103  * c-basic-offset: 4
104  * indent-tabs-mode: t
105  * End:
106  */
107