Deleted Added
full compact
zend_API.h (6c810b0d) zend_API.h (8146078f)
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1998-2007 Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1998-2007 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 |
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> |

--- 41 unchanged lines hidden (view full) ---

58#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
59#define ZEND_NAMED_ME(zend_name, name, arg_info, flags) ZEND_FENTRY(zend_name, name, arg_info, flags)
60#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
61#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
62#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
63 ZEND_FENTRY(name, ZEND_MN(classname##_##alias), arg_info, flags)
64#define ZEND_ME_MAPPING(name, func_name, arg_types, flags) ZEND_NAMED_ME(name, ZEND_FN(func_name), arg_types, flags)
65
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> |

--- 41 unchanged lines hidden (view full) ---

58#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
59#define ZEND_NAMED_ME(zend_name, name, arg_info, flags) ZEND_FENTRY(zend_name, name, arg_info, flags)
60#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
61#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
62#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
63 ZEND_FENTRY(name, ZEND_MN(classname##_##alias), arg_info, flags)
64#define ZEND_ME_MAPPING(name, func_name, arg_types, flags) ZEND_NAMED_ME(name, ZEND_FN(func_name), arg_types, flags)
65
66#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, 0, pass_by_ref, 0, 0 },
67#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, 0, pass_by_ref, 0, 0 },
68#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 },
69#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, 1, allow_null, pass_by_ref, 0, 0 },
66#define ZEND_ARG_INFO(pass_by_ref, name) { {#name}, sizeof(#name)-1, {NULL}, 0, 0, 0, pass_by_ref, 0, 0 },
67#define ZEND_ARG_PASS_INFO(pass_by_ref) { {NULL}, 0, {NULL}, 0, 0, 0, pass_by_ref, 0, 0 },
68#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { {#name}, sizeof(#name)-1, {#classname}, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 },
69#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { {#name}, sizeof(#name)-1, {NULL}, 0, 1, allow_null, pass_by_ref, 0, 0 },
70#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \
71 const zend_arg_info name[] = { \
70#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \
71 const zend_arg_info name[] = { \
72 { NULL, 0, NULL, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
72 { {NULL}, 0, {NULL}, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
73#define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \
74 ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1)
75#define ZEND_END_ARG_INFO() };
76
77/* Name macros */
78#define ZEND_MODULE_STARTUP_N(module) zm_startup_##module
79#define ZEND_MODULE_SHUTDOWN_N(module) zm_shutdown_##module
80#define ZEND_MODULE_ACTIVATE_N(module) zm_activate_##module

--- 38 unchanged lines hidden (view full) ---

119 zend_##module_name##_globals module_name##_globals;
120#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
121 extern zend_##module_name##_globals module_name##_globals;
122#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
123 globals_ctor(&module_name##_globals);
124
125#endif
126
73#define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \
74 ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1)
75#define ZEND_END_ARG_INFO() };
76
77/* Name macros */
78#define ZEND_MODULE_STARTUP_N(module) zm_startup_##module
79#define ZEND_MODULE_SHUTDOWN_N(module) zm_shutdown_##module
80#define ZEND_MODULE_ACTIVATE_N(module) zm_activate_##module

--- 38 unchanged lines hidden (view full) ---

119 zend_##module_name##_globals module_name##_globals;
120#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
121 extern zend_##module_name##_globals module_name##_globals;
122#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
123 globals_ctor(&module_name##_globals);
124
125#endif
126
127#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
127#define INIT_CLASS_ENTRY(class_container, class_name, functions) \
128 INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
128
129
129#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
130#define INIT_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions) \
131 INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, NULL, NULL, NULL, NULL, NULL)
132
133#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
130 { \
134 { \
131 class_container.name = strdup(class_name); \
132 class_container.name_length = sizeof(class_name) - 1; \
135 int _len = class_name_len; \
136 if (UG(unicode)) { \
137 class_container.name.u = (UChar *)malloc(UBYTES(_len+1)); \
138 u_charsToUChars(class_name, class_container.name.u, _len+1); \
139 } else { \
140 class_container.name.s = zend_strndup(class_name, _len); \
141 } \
142 class_container.name_length = _len; \
133 class_container.builtin_functions = functions; \
134 class_container.constructor = NULL; \
135 class_container.destructor = NULL; \
136 class_container.clone = NULL; \
137 class_container.serialize = NULL; \
138 class_container.unserialize = NULL; \
139 class_container.create_object = NULL; \
140 class_container.interface_gets_implemented = NULL; \
143 class_container.builtin_functions = functions; \
144 class_container.constructor = NULL; \
145 class_container.destructor = NULL; \
146 class_container.clone = NULL; \
147 class_container.serialize = NULL; \
148 class_container.unserialize = NULL; \
149 class_container.create_object = NULL; \
150 class_container.interface_gets_implemented = NULL; \
151 class_container.get_static_method = NULL; \
141 class_container.__call = handle_fcall; \
152 class_container.__call = handle_fcall; \
153 class_container.__callstatic = NULL; \
142 class_container.__tostring = NULL; \
143 class_container.__get = handle_propget; \
144 class_container.__set = handle_propset; \
145 class_container.__unset = handle_propunset; \
146 class_container.__isset = handle_propisset; \
147 class_container.serialize_func = NULL; \
148 class_container.unserialize_func = NULL; \
149 class_container.serialize = NULL; \
150 class_container.unserialize = NULL; \
151 class_container.parent = NULL; \
152 class_container.num_interfaces = 0; \
153 class_container.interfaces = NULL; \
154 class_container.get_iterator = NULL; \
155 class_container.iterator_funcs.funcs = NULL; \
156 class_container.module = NULL; \
157 }
158
159#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
154 class_container.__tostring = NULL; \
155 class_container.__get = handle_propget; \
156 class_container.__set = handle_propset; \
157 class_container.__unset = handle_propunset; \
158 class_container.__isset = handle_propisset; \
159 class_container.serialize_func = NULL; \
160 class_container.unserialize_func = NULL; \
161 class_container.serialize = NULL; \
162 class_container.unserialize = NULL; \
163 class_container.parent = NULL; \
164 class_container.num_interfaces = 0; \
165 class_container.interfaces = NULL; \
166 class_container.get_iterator = NULL; \
167 class_container.iterator_funcs.funcs = NULL; \
168 class_container.module = NULL; \
169 }
170
171#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
160 INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL)
172 INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL)
161
162#ifdef ZTS
163# define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(zend_intptr_t)(ce)->static_members])
164#else
165# define CE_STATIC_MEMBERS(ce) ((ce)->static_members)
166#endif
167
173
174#ifdef ZTS
175# define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(zend_intptr_t)(ce)->static_members])
176#else
177# define CE_STATIC_MEMBERS(ce) ((ce)->static_members)
178#endif
179
180#define ZEND_FCI_INITIALIZED(fci) ((fci).size != 0)
181
168int zend_next_free_module(void);
169
170BEGIN_EXTERN_C()
171ZEND_API int zend_get_parameters(int ht, int param_count, ...);
172ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
173ZEND_API int zend_get_parameters_ex(int param_count, ...);
174ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC);
175

--- 38 unchanged lines hidden (view full) ---

214ZEND_API void zend_wrong_param_count(TSRMLS_D);
215
216#define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0)
217#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
218#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
219
220#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
221
182int zend_next_free_module(void);
183
184BEGIN_EXTERN_C()
185ZEND_API int zend_get_parameters(int ht, int param_count, ...);
186ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
187ZEND_API int zend_get_parameters_ex(int param_count, ...);
188ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC);
189

--- 38 unchanged lines hidden (view full) ---

228ZEND_API void zend_wrong_param_count(TSRMLS_D);
229
230#define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0)
231#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
232#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
233
234#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
235
222ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
223ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
224ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
236ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *callable_name, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
237ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name);
238ZEND_API zend_bool zend_make_callable(zval *callable, zval *callable_name TSRMLS_DC);
225ZEND_API const char *zend_get_module_version(const char *module_name);
226ZEND_API int zend_get_module_started(char *module_name);
227ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
239ZEND_API const char *zend_get_module_version(const char *module_name);
240ZEND_API int zend_get_module_started(char *module_name);
241ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
228ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC);
242ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment_len TSRMLS_DC);
229ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
230ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
231ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
232ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC);
233ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
234ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
235
243ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
244ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
245ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
246ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC);
247ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
248ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
249
250ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC);
251ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, zstr doc_comment, int doc_comment_len TSRMLS_DC);
252
236ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
237ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC);
238ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
239ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC);
240ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC);
241ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC);
242ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC);
243
244ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
245ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
246ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
247ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
248ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
249ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
250ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
251ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
253ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
254ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC);
255ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
256ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC);
257ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC);
258ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC);
259ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC);
260
261ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
262ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
263ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
264ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
265ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
266ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
267ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
268ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
269ZEND_API void zend_update_property_ascii_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
270ZEND_API void zend_update_property_ascii_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
271ZEND_API void zend_update_property_rt_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
272ZEND_API void zend_update_property_rt_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
273ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC);
274ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value, int value_length TSRMLS_DC);
252
275
276#define zend_update_property_text(ce, obj, key, key_len, str) \
277 if (UG(unicode)) { \
278 zend_update_property_unicode(ce, obj, key, key_len, (str).u TSRMLS_CC); \
279 } else { \
280 zend_update_property_string(ce, obj, key, key_len, (str).s TSRMLS_CC); \
281 }
282
283#define zend_update_property_textl(ce, obj, key, key_len, str, len) \
284 if (UG(unicode)) { \
285 zend_update_property_unicodel(ce, obj, key, key_len, str.u, len TSRMLS_CC); \
286 } else { \
287 zend_update_property_stringl(ce, obj, key, key_len, str.s, len TSRMLS_CC); \
288 }
289
290
253ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC);
254ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC);
255ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
256ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
257ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC);
258ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
259ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
291ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC);
292ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC);
293ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
294ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
295ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC);
296ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
297ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
298ZEND_API int zend_update_static_property_ascii_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
299ZEND_API int zend_update_static_property_ascii_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
300ZEND_API int zend_update_static_property_rt_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
301ZEND_API int zend_update_static_property_rt_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
302ZEND_API int zend_update_static_property_unicode(zend_class_entry *scope, char *name, int name_length, UChar *value TSRMLS_DC);
303ZEND_API int zend_update_static_property_unicodel(zend_class_entry *scope, char *name, int name_length, UChar *value, int value_length TSRMLS_DC);
260
261ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
262
263ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
264
265ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
304
305ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
306
307ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
308
309ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
266ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC);
310ZEND_API int zend_get_object_classname(zval *object, zstr *class_name, zend_uint *class_name_len TSRMLS_DC);
311ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...);
267ZEND_API char *zend_get_type_by_const(int type);
268
269#define getThis() (this_ptr)
270
271#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
272#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
273#define ARG_COUNT(dummy) (ht)
274#define ZEND_NUM_ARGS() (ht)

--- 13 unchanged lines hidden (view full) ---

288ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
289ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
290
291ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC);
292
293/* no longer supported */
294ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
295
312ZEND_API char *zend_get_type_by_const(int type);
313
314#define getThis() (this_ptr)
315
316#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
317#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
318#define ARG_COUNT(dummy) (ht)
319#define ZEND_NUM_ARGS() (ht)

--- 13 unchanged lines hidden (view full) ---

333ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC TSRMLS_DC);
334ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC);
335
336ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC);
337
338/* no longer supported */
339ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
340
296ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n);
297ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len);
298ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
299ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r);
300ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
301ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
302ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate);
341#define ZSTR_DUPLICATE (1<<0)
342#define ZSTR_AUTOFREE (1<<1)
343
303ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
304
344ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
345
346#define add_assoc_null_ex(arg, key, key_len) do { \
347 zval *___tmp; \
348 MAKE_STD_ZVAL(___tmp); \
349 ZVAL_NULL(___tmp); \
350 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
351 } while (0)
352#define add_assoc_long_ex(arg, key, key_len, n) do { \
353 zval *___tmp; \
354 MAKE_STD_ZVAL(___tmp); \
355 ZVAL_LONG(___tmp, n); \
356 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
357 } while (0)
358#define add_assoc_bool_ex(arg, key, key_len, b) do { \
359 zval *___tmp; \
360 MAKE_STD_ZVAL(___tmp); \
361 ZVAL_BOOL(___tmp, b); \
362 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
363 } while (0)
364#define add_assoc_resource_ex(arg, key, key_len, r) do { \
365 zval *___tmp; \
366 MAKE_STD_ZVAL(___tmp); \
367 ZVAL_RESOURCE(___tmp, r); \
368 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
369 } while (0)
370#define add_assoc_double_ex(arg, key, key_len, d) do { \
371 zval *___tmp; \
372 MAKE_STD_ZVAL(___tmp); \
373 ZVAL_DOUBLE(___tmp, d); \
374 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
375 } while (0)
376#define add_assoc_stringl_ex(arg, key, key_len, str, length, duplicate) do { \
377 zval *___tmp; \
378 MAKE_STD_ZVAL(___tmp); \
379 ZVAL_STRINGL(___tmp, str, length, duplicate); \
380 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
381 } while (0)
382#define add_assoc_unicode_ex(arg, key, key_len, str, duplicate) do { \
383 zval *___tmp; \
384 MAKE_STD_ZVAL(___tmp); \
385 ZVAL_UNICODE(___tmp, str, duplicate); \
386 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
387 } while (0)
388#define add_assoc_unicodel_ex(arg, key, key_len, str, length, duplicate) do { \
389 zval *___tmp; \
390 MAKE_STD_ZVAL(___tmp); \
391 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
392 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
393 } while (0)
394#define add_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \
395 zval *___tmp; \
396 MAKE_STD_ZVAL(___tmp); \
397 ZVAL_ZSTR(___tmp, type, str, duplicate); \
398 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
399 } while (0)
400#define add_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \
401 zval *___tmp; \
402 MAKE_STD_ZVAL(___tmp); \
403 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
404 add_assoc_zval_ex(arg, key, key_len, ___tmp); \
405 } while (0)
406#define add_assoc_text_ex(arg, key, key_len, str, duplicate) do { \
407 if (UG(unicode)) { \
408 add_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \
409 } else { \
410 add_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \
411 } \
412 } while (0)
413#define add_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \
414 if (UG(unicode)) { \
415 add_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
416 } else { \
417 add_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
418 } \
419 } while (0)
420
421#define add_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \
422 if (UG(unicode)) { \
423 int ___u_len = length; \
424 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
425 ___u_str[___u_len] = 0; \
426 if ((flags) & ZSTR_AUTOFREE) { \
427 efree(str); \
428 } \
429 add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
430 } else { \
431 add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
432 } \
433 } while (0)
434#define add_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \
435 if (UG(unicode)) { \
436 UChar *___u_str; \
437 int ___u_len; \
438 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
439 add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
440 } \
441 if ((flags) & ZSTR_AUTOFREE) { \
442 efree(str); \
443 } \
444 } else { \
445 add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
446 } \
447 } while (0)
448#define add_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \
449 if (UG(unicode)) { \
450 UChar *___u_str; \
451 int ___u_len; \
452 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
453 add_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
454 } \
455 if ((flags) & ZSTR_AUTOFREE) { \
456 efree(str); \
457 } \
458 } else { \
459 add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
460 } \
461 } while (0)
462#define add_assoc_string_ex(arg, key, key_len, str, flags) add_assoc_stringl_ex(arg, key, key_len, str, strlen(str), flags)
463#define add_assoc_ascii_string_ex(arg, key, key_len, str, flags) add_assoc_ascii_stringl_ex(arg, key, key_len, str, strlen(str), flags)
464#define add_assoc_rt_string_ex(arg, key, key_len, str, flags) add_assoc_rt_stringl_ex(arg, key, key_len, str, strlen(str), flags)
465#define add_assoc_utf8_string_ex(arg, key, key_len, str, flags) add_assoc_utf8_stringl_ex(arg, key, key_len, str, strlen(str), flags)
466
467#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
305#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
306#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
307#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
308#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
309#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
310#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
311#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
468#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
469#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
470#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
471#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
472#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
473#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
474#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
312#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
475#define add_assoc_unicode(__arg, __key, __str, __duplicate) add_assoc_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
476#define add_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
477#define add_assoc_zstr(__arg, __key, __type, __str, __duplicate) add_assoc_zstr_ex(__arg, __key, strlen(__key)+1, __type, __str, __duplicate)
478#define add_assoc_zstrl(__arg, __key, __type, __str, __length, __duplicate) add_assoc_zstrl_ex(__arg, __key, strlen(__key)+1, __type, __str, __length, __duplicate)
479#define add_assoc_ascii_string(arg, key, str, flags) add_assoc_ascii_string_ex(arg, key, strlen(key)+1, str, flags)
480#define add_assoc_ascii_stringl(arg, key, str, length, flags) add_assoc_ascii_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
481#define add_assoc_rt_string(__arg, __key, __str, __duplicate) add_assoc_rt_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
482#define add_assoc_rt_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
483#define add_assoc_utf8_string(__arg, __key, __str, __duplicate) add_assoc_utf8_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
484#define add_assoc_utf8_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_utf8_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
485#define add_assoc_text(arg, key, str, duplicate) add_assoc_text_ex(arg, key, strlen(key)+1, str, duplicate)
486#define add_assoc_textl(arg, key, str, length, duplicate) add_assoc_textl_ex(arg, key, strlen(key)+1, str, length, duplicate)
313
487
488ZEND_API int add_ascii_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
489
490#define add_ascii_assoc_null_ex(arg, key, key_len) do { \
491 zval *___tmp; \
492 MAKE_STD_ZVAL(___tmp); \
493 ZVAL_NULL(___tmp); \
494 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
495 } while (0)
496#define add_ascii_assoc_long_ex(arg, key, key_len, n) do { \
497 zval *___tmp; \
498 MAKE_STD_ZVAL(___tmp); \
499 ZVAL_LONG(___tmp, n); \
500 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
501 } while (0)
502#define add_ascii_assoc_bool_ex(arg, key, key_len, b) do { \
503 zval *___tmp; \
504 MAKE_STD_ZVAL(___tmp); \
505 ZVAL_BOOL(___tmp, b); \
506 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
507 } while (0)
508#define add_ascii_assoc_resource_ex(arg, key, key_len, r) do { \
509 zval *___tmp; \
510 MAKE_STD_ZVAL(___tmp); \
511 ZVAL_RESOURCE(___tmp, r); \
512 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
513 } while (0)
514#define add_ascii_assoc_double_ex(arg, key, key_len, d) do { \
515 zval *___tmp; \
516 MAKE_STD_ZVAL(___tmp); \
517 ZVAL_DOUBLE(___tmp, d); \
518 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
519 } while (0)
520#define add_ascii_assoc_stringl_ex(arg, key, key_len, str, length, duplicate) do { \
521 zval *___tmp; \
522 MAKE_STD_ZVAL(___tmp); \
523 ZVAL_STRINGL(___tmp, str, length, duplicate); \
524 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
525 } while (0)
526#define add_ascii_assoc_unicode_ex(arg, key, key_len, str, duplicate) do { \
527 zval *___tmp; \
528 MAKE_STD_ZVAL(___tmp); \
529 ZVAL_UNICODE(___tmp, str, duplicate); \
530 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
531 } while (0)
532#define add_ascii_assoc_unicodel_ex(arg, key, key_len, str, length, duplicate) do { \
533 zval *___tmp; \
534 MAKE_STD_ZVAL(___tmp); \
535 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
536 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
537 } while (0)
538#define add_ascii_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \
539 zval *___tmp; \
540 MAKE_STD_ZVAL(___tmp); \
541 ZVAL_ZSTR(___tmp, type, str, duplicate); \
542 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
543 } while (0)
544#define add_ascii_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \
545 zval *___tmp; \
546 MAKE_STD_ZVAL(___tmp); \
547 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
548 add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \
549 } while (0)
550#define add_ascii_assoc_text_ex(arg, key, key_len, str, duplicate) do { \
551 if (UG(unicode)) { \
552 add_ascii_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \
553 } else { \
554 add_ascii_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \
555 } \
556 } while (0)
557#define add_ascii_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \
558 if (UG(unicode)) { \
559 add_ascii_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
560 } else { \
561 add_ascii_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
562 } \
563 } while (0)
564
565#define add_ascii_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \
566 if (UG(unicode)) { \
567 int ___u_len = length; \
568 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
569 ___u_str[___u_len] = 0; \
570 if ((flags) & ZSTR_AUTOFREE) { \
571 efree(str); \
572 } \
573 add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
574 } else { \
575 add_ascii_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
576 } \
577 } while (0)
578#define add_ascii_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \
579 if (UG(unicode)) { \
580 UChar *___u_str; \
581 int ___u_len; \
582 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
583 add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
584 } \
585 if ((flags) & ZSTR_AUTOFREE) { \
586 efree(str); \
587 } \
588 } else { \
589 add_ascii_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
590 } \
591 } while (0)
592#define add_ascii_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \
593 if (UG(unicode)) { \
594 UChar *___u_str; \
595 int ___u_len; \
596 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
597 add_ascii_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
598 } \
599 if ((flags) & ZSTR_AUTOFREE) { \
600 efree(str); \
601 } \
602 } else { \
603 add_ascii_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
604 } \
605 } while (0)
606
607#define add_ascii_assoc_string_ex(arg, key, key_len, str, flags) add_ascii_assoc_stringl_ex(arg, key, key_len, str, strlen(str), flags)
608#define add_ascii_assoc_ascii_string_ex(arg, key, key_len, str, flags) add_ascii_assoc_ascii_stringl_ex(arg, key, key_len, str, strlen(str), flags)
609#define add_ascii_assoc_rt_string_ex(arg, key, key_len, str, flags) add_ascii_assoc_rt_stringl_ex(arg, key, key_len, str, strlen(str), flags)
610#define add_ascii_assoc_utf8_string_ex(arg, key, key_len, str, flags) add_ascii_assoc_utf8_stringl_ex(arg, key, key_len, str, strlen(str), flags)
611
612#define add_ascii_assoc_zval(__arg, __key, __value) add_ascii_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
613#define add_ascii_assoc_long(__arg, __key, __n) add_ascii_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
614#define add_ascii_assoc_null(__arg, __key) add_ascii_assoc_null_ex(__arg, __key, strlen(__key)+1)
615#define add_ascii_assoc_bool(__arg, __key, __b) add_ascii_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
616#define add_ascii_assoc_resource(__arg, __key, __r) add_ascii_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
617#define add_ascii_assoc_double(__arg, __key, __d) add_ascii_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
618#define add_ascii_assoc_string(__arg, __key, __str, __duplicate) add_ascii_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
619#define add_ascii_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_ascii_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
620#define add_ascii_assoc_unicode(__arg, __key, __str, __duplicate) add_ascii_assoc_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
621#define add_ascii_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_ascii_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
622#define add_ascii_assoc_zstr(arg, key, type, str, duplicate) add_ascii_assoc_zstr_ex(arg, key, strlen(key)+1, type, str, duplicate)
623#define add_ascii_assoc_zstrl(arg, key, type, str, length, duplicate) add_ascii_assoc_zstrl_ex(arg, key, strlen(key)+1, type, str, length, duplicate)
624#define add_ascii_assoc_ascii_string(arg, key, str, flags) add_ascii_assoc_ascii_string_ex(arg, key, strlen(key)+1, str, flags)
625#define add_ascii_assoc_ascii_stringl(arg, key, str, length, flags) add_ascii_assoc_ascii_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
626#define add_ascii_assoc_rt_string(arg, key, str, flags) add_ascii_assoc_rt_stringl_ex(arg, key, strlen(key)+1, str, strlen(str), flags)
627#define add_ascii_assoc_rt_stringl(arg, key, str, length, flags) add_ascii_assoc_rt_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
628#define add_ascii_assoc_utf8_string(arg, key, str, flags) add_ascii_assoc_utf8_stringl_ex(arg, key, strlen(key)+1, str, strlen(str), flags)
629#define add_ascii_assoc_utf8_stringl(arg, key, str, length, flags) add_ascii_assoc_utf8_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
630#define add_ascii_assoc_text(__arg, __key, __str, __duplicate) add_ascii_assoc_text_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
631#define add_ascii_assoc_textl(__arg, __key, __str, __length, __duplicate) add_ascii_assoc_textl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
632
633ZEND_API int add_rt_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
634
635#define add_rt_assoc_null_ex(arg, key, key_len) do { \
636 zval *___tmp; \
637 MAKE_STD_ZVAL(___tmp); \
638 ZVAL_NULL(___tmp); \
639 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
640 } while (0)
641#define add_rt_assoc_long_ex(arg, key, key_len, n) do { \
642 zval *___tmp; \
643 MAKE_STD_ZVAL(___tmp); \
644 ZVAL_LONG(___tmp, n); \
645 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
646 } while (0)
647#define add_rt_assoc_bool_ex(arg, key, key_len, b) do { \
648 zval *___tmp; \
649 MAKE_STD_ZVAL(___tmp); \
650 ZVAL_BOOL(___tmp, b); \
651 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
652 } while (0)
653#define add_rt_assoc_resource_ex(arg, key, key_len, r) do { \
654 zval *___tmp; \
655 MAKE_STD_ZVAL(___tmp); \
656 ZVAL_RESOURCE(___tmp, r); \
657 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
658 } while (0)
659#define add_rt_assoc_double_ex(arg, key, key_len, d) do { \
660 zval *___tmp; \
661 MAKE_STD_ZVAL(___tmp); \
662 ZVAL_DOUBLE(___tmp, d); \
663 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
664 } while (0)
665#define add_rt_assoc_stringl_ex(arg, key, key_len, str, length, duplicate) do { \
666 zval *___tmp; \
667 MAKE_STD_ZVAL(___tmp); \
668 ZVAL_STRINGL(___tmp, str, length, duplicate); \
669 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
670 } while (0)
671#define add_rt_assoc_unicode_ex(arg, key, key_len, str, duplicate) do { \
672 zval *___tmp; \
673 MAKE_STD_ZVAL(___tmp); \
674 ZVAL_UNICODE(___tmp, str, duplicate); \
675 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
676 } while (0)
677#define add_rt_assoc_unicodel_ex(arg, key, key_len, str, length, duplicate) do { \
678 zval *___tmp; \
679 MAKE_STD_ZVAL(___tmp); \
680 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
681 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
682 } while (0)
683#define add_rt_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \
684 zval *___tmp; \
685 MAKE_STD_ZVAL(___tmp); \
686 ZVAL_ZSTR(___tmp, type, str, duplicate); \
687 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
688 } while (0)
689#define add_rt_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \
690 zval *___tmp; \
691 MAKE_STD_ZVAL(___tmp); \
692 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
693 add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \
694 } while (0)
695#define add_rt_assoc_text_ex(arg, key, key_len, str, duplicate) do { \
696 if (UG(unicode)) { \
697 add_rt_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \
698 } else { \
699 add_rt_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \
700 } \
701 } while (0)
702#define add_rt_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \
703 if (UG(unicode)) { \
704 add_rt_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
705 } else { \
706 add_rt_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
707 } \
708 } while (0)
709
710#define add_rt_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \
711 if (UG(unicode)) { \
712 int ___u_len = length; \
713 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
714 ___u_str[___u_len] = 0; \
715 if ((flags) & ZSTR_AUTOFREE) { \
716 efree(str); \
717 } \
718 add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
719 } else { \
720 add_rt_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
721 } \
722 } while (0)
723#define add_rt_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \
724 if (UG(unicode)) { \
725 UChar *___u_str; \
726 int ___u_len; \
727 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
728 add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
729 } \
730 if ((flags) & ZSTR_AUTOFREE) { \
731 efree(str); \
732 } \
733 } else { \
734 add_rt_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
735 } \
736 } while (0)
737#define add_rt_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \
738 if (UG(unicode)) { \
739 UChar *___u_str; \
740 int ___u_len; \
741 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
742 add_rt_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
743 } \
744 if ((flags) & ZSTR_AUTOFREE) { \
745 efree(str); \
746 } \
747 } else { \
748 add_rt_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
749 } \
750 } while (0)
751
752#define add_rt_assoc_string_ex(arg, key, key_len, str, flags) add_rt_assoc_stringl_ex(arg, key, key_len, str, strlen(str), flags)
753#define add_rt_assoc_ascii_string_ex(arg, key, key_len, str, flags) add_rt_assoc_ascii_stringl_ex(arg, key, key_len, str, strlen(str), flags)
754#define add_rt_assoc_rt_string_ex(arg, key, key_len, str, flags) add_rt_assoc_rt_stringl_ex(arg, key, key_len, str, strlen(str), flags)
755#define add_rt_assoc_utf8_string_ex(arg, key, key_len, str, flags) add_rt_assoc_utf8_stringl_ex(arg, key, key_len, str, strlen(str), flags)
756
757#define add_rt_assoc_zval(__arg, __key, __value) add_rt_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
758#define add_rt_assoc_long(__arg, __key, __n) add_rt_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
759#define add_rt_assoc_null(__arg, __key) add_rt_assoc_null_ex(__arg, __key, strlen(__key)+1)
760#define add_rt_assoc_bool(__arg, __key, __b) add_rt_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
761#define add_rt_assoc_resource(__arg, __key, __r) add_rt_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
762#define add_rt_assoc_double(__arg, __key, __d) add_rt_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
763#define add_rt_assoc_string(__arg, __key, __str, __duplicate) add_rt_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
764#define add_rt_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_rt_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
765#define add_rt_assoc_unicode(__arg, __key, __str, __duplicate) add_rt_assoc_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
766#define add_rt_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_rt_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
767#define add_rt_assoc_zstr(arg, key, type, str, duplicate) add_rt_assoc_zstr_ex(arg, key, strlen(key)+1, type, str, duplicate)
768#define add_rt_assoc_zstrl(arg, key, type, str, length, duplicate) add_rt_assoc_zstrl_ex(arg, key, strlen(key)+1, type, str, length, duplicate)
769#define add_rt_assoc_ascii_string(arg, key, str, flags) add_rt_assoc_ascii_string_ex(arg, key, strlen(key)+1, str, flags)
770#define add_rt_assoc_ascii_stringl(arg, key, str, length, flags) add_rt_assoc_ascii_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
771#define add_rt_assoc_rt_string(arg, key, str, flags) add_rt_assoc_rt_stringl_ex(arg, key, strlen(key)+1, str, strlen(str), flags)
772#define add_rt_assoc_rt_stringl(arg, key, str, length, flags) add_rt_assoc_rt_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
773#define add_rt_assoc_utf8_string(arg, key, str, flags) add_rt_assoc_utf8_stringl_ex(arg, key, strlen(key)+1, str, strlen(str), flags)
774#define add_rt_assoc_utf8_stringl(arg, key, str, length, flags) add_rt_assoc_utf8_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
775#define add_rt_assoc_text(__arg, __key, __str, __duplicate) add_rt_assoc_text_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
776#define add_rt_assoc_textl(__arg, __key, __str, __length, __duplicate) add_rt_assoc_textl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
777
778ZEND_API int add_utf8_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
779
780#define add_utf8_assoc_null_ex(arg, key, key_len) do { \
781 zval *___tmp; \
782 MAKE_STD_ZVAL(___tmp); \
783 ZVAL_NULL(___tmp); \
784 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
785 } while (0)
786#define add_utf8_assoc_long_ex(arg, key, key_len, n) do { \
787 zval *___tmp; \
788 MAKE_STD_ZVAL(___tmp); \
789 ZVAL_LONG(___tmp, n); \
790 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
791 } while (0)
792#define add_utf8_assoc_bool_ex(arg, key, key_len, b) do { \
793 zval *___tmp; \
794 MAKE_STD_ZVAL(___tmp); \
795 ZVAL_BOOL(___tmp, b); \
796 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
797 } while (0)
798#define add_utf8_assoc_resource_ex(arg, key, key_len, r) do { \
799 zval *___tmp; \
800 MAKE_STD_ZVAL(___tmp); \
801 ZVAL_RESOURCE(___tmp, r); \
802 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
803 } while (0)
804#define add_utf8_assoc_double_ex(arg, key, key_len, d) do { \
805 zval *___tmp; \
806 MAKE_STD_ZVAL(___tmp); \
807 ZVAL_DOUBLE(___tmp, d); \
808 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
809 } while (0)
810#define add_utf8_assoc_stringl_ex(arg, key, key_len, str, length, duplicate) do { \
811 zval *___tmp; \
812 MAKE_STD_ZVAL(___tmp); \
813 ZVAL_STRINGL(___tmp, str, length, duplicate); \
814 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
815 } while (0)
816#define add_utf8_assoc_unicode_ex(arg, key, key_len, str, duplicate) do { \
817 zval *___tmp; \
818 MAKE_STD_ZVAL(___tmp); \
819 ZVAL_UNICODE(___tmp, str, duplicate); \
820 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
821 } while (0)
822#define add_utf8_assoc_unicodel_ex(arg, key, key_len, str, length, duplicate) do { \
823 zval *___tmp; \
824 MAKE_STD_ZVAL(___tmp); \
825 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
826 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
827 } while (0)
828#define add_utf8_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \
829 zval *___tmp; \
830 MAKE_STD_ZVAL(___tmp); \
831 ZVAL_ZSTR(___tmp, type, str, duplicate); \
832 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
833 } while (0)
834#define add_utf8_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \
835 zval *___tmp; \
836 MAKE_STD_ZVAL(___tmp); \
837 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
838 add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \
839 } while (0)
840#define add_utf8_assoc_text_ex(arg, key, key_len, str, duplicate) do { \
841 if (UG(unicode)) { \
842 add_utf8_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \
843 } else { \
844 add_utf8_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \
845 } \
846 } while (0)
847#define add_utf8_assoc_textl_ex(arg, key, key_len, str, length, duplicate) do { \
848 if (UG(unicode)) { \
849 add_utf8_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
850 } else { \
851 add_utf8_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
852 } \
853 } while (0)
854
855#define add_utf8_assoc_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \
856 if (UG(unicode)) { \
857 int ___u_len = length; \
858 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
859 ___u_str[___u_len] = 0; \
860 if ((flags) & ZSTR_AUTOFREE) { \
861 efree(str); \
862 } \
863 add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
864 } else { \
865 add_utf8_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
866 } \
867 } while (0)
868#define add_utf8_assoc_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \
869 if (UG(unicode)) { \
870 UChar *___u_str; \
871 int ___u_len; \
872 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
873 add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
874 } \
875 if ((flags) & ZSTR_AUTOFREE) { \
876 efree(str); \
877 } \
878 } else { \
879 add_utf8_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
880 } \
881 } while (0)
882#define add_utf8_assoc_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \
883 if (UG(unicode)) { \
884 UChar *___u_str; \
885 int ___u_len; \
886 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
887 add_utf8_assoc_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
888 } \
889 if ((flags) & ZSTR_AUTOFREE) { \
890 efree(str); \
891 } \
892 } else { \
893 add_utf8_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
894 } \
895 } while (0)
896
897#define add_utf8_assoc_string_ex(arg, key, key_len, str, flags) add_utf8_assoc_stringl_ex(arg, key, key_len, str, strlen(str), flags)
898#define add_utf8_assoc_ascii_string_ex(arg, key, key_len, str, flags) add_utf8_assoc_ascii_stringl_ex(arg, key, key_len, str, strlen(str), flags)
899#define add_utf8_assoc_rt_string_ex(arg, key, key_len, str, flags) add_utf8_assoc_rt_stringl_ex(arg, key, key_len, str, strlen(str), flags)
900#define add_utf8_assoc_utf8_string_ex(arg, key, key_len, str, flags) add_utf8_assoc_utf8_stringl_ex(arg, key, key_len, str, strlen(str), flags)
901
902#define add_utf8_assoc_zval(__arg, __key, __value) add_utf8_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
903#define add_utf8_assoc_long(__arg, __key, __n) add_utf8_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
904#define add_utf8_assoc_null(__arg, __key) add_utf8_assoc_null_ex(__arg, __key, strlen(__key)+1)
905#define add_utf8_assoc_bool(__arg, __key, __b) add_utf8_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
906#define add_utf8_assoc_resource(__arg, __key, __r) add_utf8_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
907#define add_utf8_assoc_double(__arg, __key, __d) add_utf8_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
908#define add_utf8_assoc_string(__arg, __key, __str, __duplicate) add_utf8_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
909#define add_utf8_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_utf8_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
910#define add_utf8_assoc_unicode(__arg, __key, __str, __duplicate) add_utf8_assoc_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
911#define add_utf8_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_utf8_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
912#define add_utf8_assoc_zstr(arg, key, type, str, duplicate) add_utf8_assoc_zstr_ex(arg, key, strlen(key)+1, type, str, duplicate)
913#define add_utf8_assoc_zstrl(arg, key, type, str, length, duplicate) add_utf8_assoc_zstrl_ex(arg, key, strlen(key)+1, type, str, length, duplicate)
914#define add_utf8_assoc_ascii_string(arg, key, str, flags) add_utf8_assoc_ascii_string_ex(arg, key, strlen(key)+1, str, flags)
915#define add_utf8_assoc_ascii_stringl(arg, key, str, length, flags) add_utf8_assoc_ascii_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
916#define add_utf8_assoc_rt_string(arg, key, str, flags) add_utf8_assoc_rt_stringl_ex(arg, key, strlen(key)+1, str, strlen(str), flags)
917#define add_utf8_assoc_rt_stringl(arg, key, str, length, flags) add_utf8_assoc_rt_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
918#define add_utf8_assoc_utf8_string(arg, key, str, flags) add_utf8_assoc_utf8_stringl_ex(arg, key, strlen(key)+1, str, strlen(str), flags)
919#define add_utf8_assoc_utf8_stringl(arg, key, str, length, flags) add_utf8_assoc_utf8_stringl_ex(arg, key, strlen(key)+1, str, length, flags)
920#define add_utf8_assoc_text(__arg, __key, __str, __duplicate) add_utf8_assoc_text_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
921#define add_utf8_assoc_textl(__arg, __key, __str, __length, __duplicate) add_utf8_assoc_textl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
922
923ZEND_API int add_utf8_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC);
924
925#define add_utf8_property_null_ex(arg, key, key_len) do { \
926 zval *___tmp; \
927 MAKE_STD_ZVAL(___tmp); \
928 ZVAL_NULL(___tmp); \
929 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
930 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
931 } while (0)
932#define add_utf8_property_long_ex(arg, key, key_len, n) do { \
933 zval *___tmp; \
934 MAKE_STD_ZVAL(___tmp); \
935 ZVAL_LONG(___tmp, n); \
936 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
937 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
938 } while (0)
939#define add_utf8_property_bool_ex(arg, key, key_len, b) do { \
940 zval *___tmp; \
941 MAKE_STD_ZVAL(___tmp); \
942 ZVAL_BOOL(___tmp, b); \
943 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
944 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
945 } while (0)
946#define add_utf8_property_resource_ex(arg, key, key_len, r) do { \
947 zval *___tmp; \
948 MAKE_STD_ZVAL(___tmp); \
949 ZVAL_RESOURCE(___tmp, r); \
950 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
951 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
952 } while (0)
953#define add_utf8_property_double_ex(arg, key, key_len, d) do { \
954 zval *___tmp; \
955 MAKE_STD_ZVAL(___tmp); \
956 ZVAL_DOUBLE(___tmp, d); \
957 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
958 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
959 } while (0)
960#define add_utf8_property_stringl_ex(arg, key, key_len, str, length, duplicate) do { \
961 zval *___tmp; \
962 MAKE_STD_ZVAL(___tmp); \
963 ZVAL_STRINGL(___tmp, str, length, duplicate); \
964 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
965 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
966 } while (0)
967#define add_utf8_property_unicode_ex(arg, key, key_len, str, duplicate) do { \
968 zval *___tmp; \
969 MAKE_STD_ZVAL(___tmp); \
970 ZVAL_UNICODE(___tmp, str, duplicate); \
971 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
972 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
973 } while (0)
974#define add_utf8_property_unicodel_ex(arg, key, key_len, str, length, duplicate) do { \
975 zval *___tmp; \
976 MAKE_STD_ZVAL(___tmp); \
977 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
978 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
979 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
980 } while (0)
981#define add_utf8_property_zstr_ex(arg, key, key_len, type, str, duplicate) do { \
982 zval *___tmp; \
983 MAKE_STD_ZVAL(___tmp); \
984 ZVAL_ZSTR(___tmp, type, str, duplicate); \
985 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
986 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
987 } while (0)
988#define add_utf8_property_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \
989 zval *___tmp; \
990 MAKE_STD_ZVAL(___tmp); \
991 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
992 add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \
993 zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \
994 } while (0)
995#define add_utf8_property_text_ex(arg, key, key_len, str, duplicate) do { \
996 if (UG(unicode)) { \
997 add_utf8_property_unicode_ex(arg, key, key_len, (str).u, duplicate); \
998 } else { \
999 add_utf8_property_string_ex(arg, key, key_len, (str).s, duplicate); \
1000 } \
1001 } while (0)
1002#define add_utf8_property_textl_ex(arg, key, key_len, str, length, duplicate) do { \
1003 if (UG(unicode)) { \
1004 add_utf8_property_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \
1005 } else { \
1006 add_utf8_property_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \
1007 } \
1008 } while (0)
1009
1010#define add_utf8_property_ascii_stringl_ex(arg, key, key_len, str, length, flags) do { \
1011 if (UG(unicode)) { \
1012 int ___u_len = length; \
1013 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
1014 ___u_str[___u_len] = 0; \
1015 if ((flags) & ZSTR_AUTOFREE) { \
1016 efree(str); \
1017 } \
1018 add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
1019 } else { \
1020 add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1021 } \
1022 } while (0)
1023#define add_utf8_property_rt_stringl_ex(arg, key, key_len, str, length, flags) do { \
1024 if (UG(unicode)) { \
1025 UChar *___u_str; \
1026 int ___u_len; \
1027 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1028 add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
1029 } \
1030 if ((flags) & ZSTR_AUTOFREE) { \
1031 efree(str); \
1032 } \
1033 } else { \
1034 add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1035 } \
1036 } while (0)
1037#define add_utf8_property_utf8_stringl_ex(arg, key, key_len, str, length, flags) do { \
1038 if (UG(unicode)) { \
1039 UChar *___u_str; \
1040 int ___u_len; \
1041 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1042 add_utf8_property_unicodel_ex(arg, key, key_len, ___u_str, ___u_len, 0); \
1043 } \
1044 if ((flags) & ZSTR_AUTOFREE) { \
1045 efree(str); \
1046 } \
1047 } else { \
1048 add_utf8_property_stringl_ex(arg, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1049 } \
1050 } while (0)
1051
1052ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_len, zval *value);
1053
1054#define add_u_assoc_null_ex(arg, type, key, key_len) do { \
1055 zval *___tmp; \
1056 MAKE_STD_ZVAL(___tmp); \
1057 ZVAL_NULL(___tmp); \
1058 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1059 } while (0)
1060#define add_u_assoc_long_ex(arg, type, key, key_len, n) do { \
1061 zval *___tmp; \
1062 MAKE_STD_ZVAL(___tmp); \
1063 ZVAL_LONG(___tmp, n); \
1064 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1065 } while (0)
1066#define add_u_assoc_bool_ex(arg, type, key, key_len, b) do { \
1067 zval *___tmp; \
1068 MAKE_STD_ZVAL(___tmp); \
1069 ZVAL_BOOL(___tmp, b); \
1070 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1071 } while (0)
1072#define add_u_assoc_resource_ex(arg, type, key, key_len, r) do { \
1073 zval *___tmp; \
1074 MAKE_STD_ZVAL(___tmp); \
1075 ZVAL_RESOURCE(___tmp, r); \
1076 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1077 } while (0)
1078#define add_u_assoc_double_ex(arg, type, key, key_len, d) do { \
1079 zval *___tmp; \
1080 MAKE_STD_ZVAL(___tmp); \
1081 ZVAL_DOUBLE(___tmp, d); \
1082 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1083 } while (0)
1084#define add_u_assoc_stringl_ex(arg, type, key, key_len, str, length, duplicate) do { \
1085 zval *___tmp; \
1086 MAKE_STD_ZVAL(___tmp); \
1087 ZVAL_STRINGL(___tmp, str, length, duplicate); \
1088 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1089 } while (0)
1090#define add_u_assoc_unicode_ex(arg, type, key, key_len, str, duplicate) do { \
1091 zval *___tmp; \
1092 MAKE_STD_ZVAL(___tmp); \
1093 ZVAL_UNICODE(___tmp, str, duplicate); \
1094 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1095 } while (0)
1096#define add_u_assoc_unicodel_ex(arg, type, key, key_len, str, length, duplicate) do { \
1097 zval *___tmp; \
1098 MAKE_STD_ZVAL(___tmp); \
1099 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
1100 add_u_assoc_zval_ex(arg, type, key, key_len, ___tmp); \
1101 } while (0)
1102#define add_u_assoc_zstr_ex(arg, key_type, key, key_len, type, str, duplicate) do { \
1103 zval *___tmp; \
1104 MAKE_STD_ZVAL(___tmp); \
1105 ZVAL_ZSTR(___tmp, type, str, duplicate); \
1106 add_u_assoc_zval_ex(arg, key_type, key, key_len, ___tmp); \
1107 } while (0)
1108#define add_u_assoc_zstrl_ex(arg, key_type, key, key_len, type, str, length, duplicate) do { \
1109 zval *___tmp; \
1110 MAKE_STD_ZVAL(___tmp); \
1111 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
1112 add_u_assoc_zval_ex(arg, key_type, key, key_len, ___tmp); \
1113 } while (0)
1114#define add_u_assoc_text_ex(arg, type, key, key_len, str, duplicate) do { \
1115 if (UG(unicode)) { \
1116 add_u_assoc_unicode_ex(arg, type, key, key_len, (str).u, duplicate); \
1117 } else { \
1118 add_u_assoc_string_ex(arg, type, key, key_len, (str).s, duplicate); \
1119 } \
1120 } while (0)
1121#define add_u_assoc_textl_ex(arg, type, key, key_len, str, length, duplicate) do { \
1122 if (UG(unicode)) { \
1123 add_u_assoc_unicodel_ex(arg, type, key, key_len, (str).u, length, duplicate); \
1124 } else { \
1125 add_u_assoc_stringl_ex(arg, type, key, key_len, (str).s, length, duplicate); \
1126 } \
1127 } while (0)
1128
1129#define add_u_assoc_ascii_stringl_ex(arg, type, key, key_len, str, length, flags) do { \
1130 if (UG(unicode)) { \
1131 int ___u_len = length; \
1132 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
1133 ___u_str[___u_len] = 0; \
1134 if ((flags) & ZSTR_AUTOFREE) { \
1135 efree(str); \
1136 } \
1137 add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \
1138 } else { \
1139 add_u_assoc_stringl_ex(arg, type, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1140 } \
1141 } while (0)
1142#define add_u_assoc_rt_stringl_ex(arg, type, key, key_len, str, length, flags) do { \
1143 if (UG(unicode)) { \
1144 UChar *___u_str; \
1145 int ___u_len; \
1146 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1147 add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \
1148 } \
1149 if ((flags) & ZSTR_AUTOFREE) { \
1150 efree(str); \
1151 } \
1152 } else { \
1153 add_u_assoc_stringl_ex(arg, type, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1154 } \
1155 } while (0)
1156#define add_u_assoc_utf8_stringl_ex(arg, type, key, key_len, str, length, flags) do { \
1157 if (UG(unicode)) { \
1158 UChar *___u_str; \
1159 int ___u_len; \
1160 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1161 add_u_assoc_unicodel_ex(arg, type, key, key_len, ___u_str, ___u_len, 0); \
1162 } \
1163 if ((flags) & ZSTR_AUTOFREE) { \
1164 efree(str); \
1165 } \
1166 } else { \
1167 add_u_assoc_stringl_ex(arg, type, key, key_len, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1168 } \
1169 } while (0)
1170
1171#define add_u_assoc_string_ex(arg, key_type, key, key_len, str, flags) add_u_assoc_stringl_ex(arg, key_type, key, key_len, str, strlen(str), flags)
1172#define add_u_assoc_ascii_string_ex(arg, key_type, key, key_len, str, flags) add_u_assoc_ascii_stringl_ex(arg, key_type, key, key_len, str, strlen(str), flags)
1173#define add_u_assoc_rt_string_ex(arg, key_type, key, key_len, str, flags) add_u_assoc_rt_stringl_ex(arg, key_type, key, key_len, str, strlen(str), flags)
1174#define add_u_assoc_utf8_string_ex(arg, key_type, key, key_len, str, flags) add_u_assoc_utf8_stringl_ex(arg, key_type, key, key_len, str, strlen(str), flags)
1175
1176#define add_u_assoc_zval(__arg, __key_type, __key, __value) add_u_assoc_zval_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __value)
1177#define add_u_assoc_long(__arg, __key_type, __key, __n) add_u_assoc_long_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __n)
1178#define add_u_assoc_null(__arg, __key_type, __key) add_u_assoc_null_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1)
1179#define add_u_assoc_bool(__arg, __key_type, __key, __b) add_u_assoc_bool_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __b)
1180#define add_u_assoc_resource(__arg, __key_type, __key, __r) add_u_assoc_resource_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __r)
1181#define add_u_assoc_double(__arg, __key_type, __key, __d) add_u_assoc_double_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __d)
1182#define add_u_assoc_string(__arg, __key_type, __key, __str, __duplicate) add_u_assoc_string_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __str, __duplicate)
1183#define add_u_assoc_stringl(__arg, __key_type, __key, __str, __length, __duplicate) add_u_assoc_stringl_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __str, __length, __duplicate)
1184#define add_u_assoc_unicode(__arg, __key_type, __key, __str, __duplicate) add_u_assoc_unicode_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __str, __duplicate)
1185#define add_u_assoc_unicodel(__arg, __key_type, __key, __str, __length, __duplicate) add_u_assoc_unicodel_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __str, __length, __duplicate)
1186#define add_u_assoc_zstr(arg, key_type, key, type, str, duplicate) add_u_assoc_zstr_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, type, str, duplicate)
1187#define add_u_assoc_zstrl(arg, key_type, key, type, str, length, duplicate) add_u_assoc_zstrl_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, type, str, length, duplicate)
1188#define add_u_assoc_ascii_string(arg, key_type, key, str, flags) add_u_assoc_ascii_string_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, str, flags)
1189#define add_u_assoc_ascii_stringl(arg, key_type, key, str, length, flags) add_u_assoc_ascii_stringl_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, str, length, flags)
1190#define add_u_assoc_rt_string(arg, key_type, key, str, flags) add_rt_assoc_u_stringl_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, str, strlen(str), flags)
1191#define add_u_assoc_rt_stringl(arg, key_type, key, str, length, flags) add_u_assoc_rt_stringl_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, str, length, flags)
1192#define add_u_assoc_utf8_string(arg, key_type, key, str, flags) add_u_assoc_utf8_stringl_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, str, strlen(str), flags)
1193#define add_u_assoc_utf8_stringl(arg, key_type, key, str, length, flags) add_u_assoc_utf8_stringl_ex(arg, key_type, key, ZSTR_LEN(__key_type, __key)+1, str, length, flags)
1194#define add_u_assoc_text(__arg, __key_type, __key, __str, __duplicate) add_u_assoc_text_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __str, __duplicate)
1195#define add_u_assoc_textl(__arg, __key_type, __key, __str, __length, __duplicate) add_u_assoc_textl_ex(__arg, __key_type, __key, ZSTR_LEN(__key_type, __key)+1, __str, __length, __duplicate)
1196
1197ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
1198
1199#define add_index_null(arg, idx) do { \
1200 zval *___tmp; \
1201 MAKE_STD_ZVAL(___tmp); \
1202 ZVAL_NULL(___tmp); \
1203 add_index_zval(arg, idx, ___tmp); \
1204 } while (0)
1205#define add_index_long(arg, idx, n) do { \
1206 zval *___tmp; \
1207 MAKE_STD_ZVAL(___tmp); \
1208 ZVAL_LONG(___tmp, n); \
1209 add_index_zval(arg, idx, ___tmp); \
1210 } while (0)
1211#define add_index_bool(arg, idx, b) do { \
1212 zval *___tmp; \
1213 MAKE_STD_ZVAL(___tmp); \
1214 ZVAL_BOOL(___tmp, b); \
1215 add_index_zval(arg, idx, ___tmp); \
1216 } while (0)
1217#define add_index_resource(arg, idx, r) do { \
1218 zval *___tmp; \
1219 MAKE_STD_ZVAL(___tmp); \
1220 ZVAL_RESOURCE(___tmp, r); \
1221 add_index_zval(arg, idx, ___tmp); \
1222 } while (0)
1223#define add_index_double(arg, idx, d) do { \
1224 zval *___tmp; \
1225 MAKE_STD_ZVAL(___tmp); \
1226 ZVAL_DOUBLE(___tmp, d); \
1227 add_index_zval(arg, idx, ___tmp); \
1228 } while (0)
1229#define add_index_stringl(arg, idx, str, length, duplicate) do { \
1230 zval *___tmp; \
1231 MAKE_STD_ZVAL(___tmp); \
1232 ZVAL_STRINGL(___tmp, str, length, duplicate); \
1233 add_index_zval(arg, idx, ___tmp); \
1234 } while (0)
1235#define add_index_unicode(arg, idx, str, duplicate) do { \
1236 zval *___tmp; \
1237 MAKE_STD_ZVAL(___tmp); \
1238 ZVAL_UNICODE(___tmp, str, duplicate); \
1239 add_index_zval(arg, idx, ___tmp); \
1240 } while (0)
1241#define add_index_unicodel(arg, idx, str, length, duplicate) do { \
1242 zval *___tmp; \
1243 MAKE_STD_ZVAL(___tmp); \
1244 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
1245 add_index_zval(arg, idx, ___tmp); \
1246 } while (0)
1247#define add_index_zstr(arg, idx, type, str, duplicate) do { \
1248 zval *___tmp; \
1249 MAKE_STD_ZVAL(___tmp); \
1250 ZVAL_ZSTR(___tmp, type, str, duplicate); \
1251 add_index_zval(arg, idx, ___tmp); \
1252 } while (0)
1253#define add_index_zstrl(arg, idx, type, str, length, duplicate) do { \
1254 zval *___tmp; \
1255 MAKE_STD_ZVAL(___tmp); \
1256 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
1257 add_index_zval(arg, idx, ___tmp); \
1258 } while (0)
1259#define add_index_text(arg, idx, str, duplicate) do { \
1260 if (UG(unicode)) { \
1261 add_index_unicode(arg, idx, (str).u, duplicate); \
1262 } else { \
1263 add_index_string(arg, idx, (str).s, duplicate); \
1264 } \
1265 } while (0)
1266#define add_index_textl(arg, idx, str, length, duplicate) do { \
1267 if (UG(unicode)) { \
1268 add_index_unicodel(arg, idx, (str).u, length, duplicate); \
1269 } else { \
1270 add_index_stringl(arg, idx, (str).s, length, duplicate); \
1271 } \
1272 } while (0)
1273
1274#define add_index_ascii_stringl(arg, idx, str, length, flags) do { \
1275 if (UG(unicode)) { \
1276 int ___u_len = length; \
1277 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
1278 ___u_str[___u_len] = 0; \
1279 if ((flags) & ZSTR_AUTOFREE) { \
1280 efree(str); \
1281 } \
1282 add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \
1283 } else { \
1284 add_index_stringl(arg, idx, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1285 } \
1286 } while (0)
1287#define add_index_rt_stringl(arg, idx, str, length, flags) do {\
1288 if (UG(unicode)) { \
1289 UChar *___u_str; \
1290 int ___u_len; \
1291 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1292 add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \
1293 } \
1294 if ((flags) & ZSTR_AUTOFREE) { \
1295 efree(str); \
1296 } \
1297 } else { \
1298 add_index_stringl(arg, idx, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1299 } \
1300 } while (0)
1301#define add_index_utf8_stringl(arg, idx, str, length, flags) do { \
1302 if (UG(unicode)) { \
1303 UChar *___u_str; \
1304 int ___u_len; \
1305 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1306 add_index_unicodel(arg, idx, ___u_str, ___u_len, 0); \
1307 } \
1308 if ((flags) & ZSTR_AUTOFREE) { \
1309 efree(str); \
1310 } \
1311 } else { \
1312 add_index_stringl(arg, idx, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1313 } \
1314 } while (0)
1315
1316#define add_index_string(arg, idx, str, flags) add_index_stringl(arg, idx, str, strlen(str), flags)
1317#define add_index_ascii_string(arg, idx, str, flags) add_index_ascii_stringl(arg, idx, str, strlen(str), flags)
1318#define add_index_rt_string(arg, idx, str, flags) add_index_rt_stringl(arg, idx, str, strlen(str), flags)
1319#define add_index_utf8_string(arg, idx, str, flags) add_index_utf8_stringl(arg, idx, str, strlen(str), flags)
1320
1321ZEND_API int add_next_index_zval(zval *arg, zval *value);
1322
1323#define add_next_index_null(arg) do { \
1324 zval *___tmp; \
1325 MAKE_STD_ZVAL(___tmp); \
1326 ZVAL_NULL(___tmp); \
1327 add_next_index_zval(arg, ___tmp); \
1328 } while (0)
1329#define add_next_index_long(arg, n) do { \
1330 zval *___tmp; \
1331 MAKE_STD_ZVAL(___tmp); \
1332 ZVAL_LONG(___tmp, n); \
1333 add_next_index_zval(arg, ___tmp); \
1334 } while (0)
1335#define add_next_index_bool(arg, b) do { \
1336 zval *___tmp; \
1337 MAKE_STD_ZVAL(___tmp); \
1338 ZVAL_BOOL(___tmp, b); \
1339 add_next_index_zval(arg, ___tmp); \
1340 } while (0)
1341#define add_next_index_resource(arg, r) do { \
1342 zval *___tmp; \
1343 MAKE_STD_ZVAL(___tmp); \
1344 ZVAL_RESOURCE(___tmp, r); \
1345 add_next_index_zval(arg, ___tmp); \
1346 } while (0)
1347#define add_next_index_double(arg, d) do { \
1348 zval *___tmp; \
1349 MAKE_STD_ZVAL(___tmp); \
1350 ZVAL_DOUBLE(___tmp, d); \
1351 add_next_index_zval(arg, ___tmp); \
1352 } while (0)
1353#define add_next_index_stringl(arg, str, length, duplicate) do { \
1354 zval *___tmp; \
1355 MAKE_STD_ZVAL(___tmp); \
1356 ZVAL_STRINGL(___tmp, str, length, duplicate); \
1357 add_next_index_zval(arg, ___tmp); \
1358 } while (0)
1359#define add_next_index_unicode(arg, str, duplicate) do { \
1360 zval *___tmp; \
1361 MAKE_STD_ZVAL(___tmp); \
1362 ZVAL_UNICODE(___tmp, str, duplicate); \
1363 add_next_index_zval(arg, ___tmp); \
1364 } while (0)
1365#define add_next_index_unicodel(arg, str, length, duplicate) do { \
1366 zval *___tmp; \
1367 MAKE_STD_ZVAL(___tmp); \
1368 ZVAL_UNICODEL(___tmp, str, length, duplicate); \
1369 add_next_index_zval(arg, ___tmp); \
1370 } while (0)
1371#define add_next_index_zstr(arg, type, str, duplicate) do { \
1372 zval *___tmp; \
1373 MAKE_STD_ZVAL(___tmp); \
1374 ZVAL_ZSTR(___tmp, type, str, duplicate); \
1375 add_next_index_zval(arg, ___tmp); \
1376 } while (0)
1377#define add_next_index_zstrl(arg, type, str, length, duplicate) do { \
1378 zval *___tmp; \
1379 MAKE_STD_ZVAL(___tmp); \
1380 ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \
1381 add_next_index_zval(arg, ___tmp); \
1382 } while (0)
1383#define add_next_index_text(arg, str, duplicate) do { \
1384 if (UG(unicode)) { \
1385 add_next_index_unicode(arg, (str).u, duplicate); \
1386 } else { \
1387 add_next_index_string(arg, (str).s, duplicate); \
1388 } \
1389 } while (0)
1390#define add_next_index_textl(arg, str, length, duplicate) do { \
1391 if (UG(unicode)) { \
1392 add_next_index_unicodel(arg, (str).u, length, duplicate); \
1393 } else { \
1394 add_next_index_stringl(arg, (str).s, length, duplicate); \
1395 } \
1396 } while (0)
1397
1398#define add_next_index_ascii_stringl(arg, str, length, flags) do { \
1399 if (UG(unicode)) { \
1400 int ___u_len = length; \
1401 UChar *___u_str = zend_ascii_to_unicode((str), (___u_len)+1 ZEND_FILE_LINE_CC); \
1402 ___u_str[___u_len] = 0; \
1403 if ((flags) & ZSTR_AUTOFREE) { \
1404 efree((char*)(str)); \
1405 } \
1406 add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \
1407 } else { \
1408 add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1409 } \
1410 } while (0)
1411#define add_next_index_rt_stringl(arg, str, length, flags) do { \
1412 if (UG(unicode)) { \
1413 UChar *___u_str; \
1414 int ___u_len; \
1415 if (zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1416 add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \
1417 } \
1418 if ((flags) & ZSTR_AUTOFREE) { \
1419 efree((char*)(str)); \
1420 } \
1421 } else { \
1422 add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1423 } \
1424 } while (0)
1425#define add_next_index_utf8_stringl(arg, str, length, flags) do { \
1426 if (UG(unicode)) { \
1427 UChar *___u_str; \
1428 int ___u_len; \
1429 if (zend_string_to_unicode(UG(utf8_conv), &___u_str, &___u_len, str, length TSRMLS_CC) == SUCCESS) { \
1430 add_next_index_unicodel(arg, ___u_str, ___u_len, 0); \
1431 } \
1432 if ((flags) & ZSTR_AUTOFREE) { \
1433 efree((char*)(str)); \
1434 } \
1435 } else { \
1436 add_next_index_stringl(arg, (char*)(str), length, (flags) & ZSTR_DUPLICATE); \
1437 } \
1438 } while (0)
1439
1440#define add_next_index_string(arg, str, flags) add_next_index_stringl(arg, str, strlen(str), flags)
1441#define add_next_index_ascii_string(arg, str, flags) add_next_index_ascii_stringl(arg, str, strlen(str), flags)
1442#define add_next_index_rt_string(arg, str, flags) add_next_index_rt_stringl(arg, str, strlen(str), flags)
1443#define add_next_index_utf8_string(arg, str, flags) add_next_index_utf8_stringl(arg, str, strlen(str), flags)
1444
314/* unset() functions are only suported for legacy modules and null() functions should be used */
315#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
316#define add_index_unset(__arg, __key) add_index_null(__arg, __key)
317#define add_next_index_unset(__arg) add_next_index_null(__arg)
318#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
319
1445/* unset() functions are only suported for legacy modules and null() functions should be used */
1446#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
1447#define add_index_unset(__arg, __key) add_index_null(__arg, __key)
1448#define add_next_index_unset(__arg) add_next_index_null(__arg)
1449#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
1450
320ZEND_API int add_index_long(zval *arg, ulong idx, long n);
321ZEND_API int add_index_null(zval *arg, ulong idx);
322ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
323ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
324ZEND_API int add_index_double(zval *arg, ulong idx, double d);
325ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate);
326ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
327ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
328
329ZEND_API int add_next_index_long(zval *arg, long n);
330ZEND_API int add_next_index_null(zval *arg);
331ZEND_API int add_next_index_bool(zval *arg, int b);
332ZEND_API int add_next_index_resource(zval *arg, int r);
333ZEND_API int add_next_index_double(zval *arg, double d);
334ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate);
335ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate);
336ZEND_API int add_next_index_zval(zval *arg, zval *value);
337
338ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate);
339ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate);
340
341#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
342#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
343
344ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
345ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
346ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate);
347ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate);
1451ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate);
1452ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate);
1453
1454#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
1455#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
1456
1457ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
1458ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
1459ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate);
1460ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate);
1461ZEND_API int add_get_index_unicode(zval *arg, ulong idx, UChar *str, void **dest, int duplicate);
1462ZEND_API int add_get_index_unicodel(zval *arg, ulong idx, UChar *str, uint length, void **dest, int duplicate);
348
349ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
350ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
351ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC);
352ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r TSRMLS_DC);
353ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC);
354ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
355ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
356ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC);
1463
1464ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
1465ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
1466ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC);
1467ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long r TSRMLS_DC);
1468ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC);
1469ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
1470ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
1471ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC);
1472ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
1473ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
1474ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
1475ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
1476ZEND_API int add_property_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate TSRMLS_DC);
1477ZEND_API int add_property_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate TSRMLS_DC);
1478ZEND_API int add_property_utf8_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
1479ZEND_API int add_property_utf8_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
1480ZEND_API int add_property_zstr_ex(zval *arg, char *key, uint key_len, zend_uchar type, zstr str, int duplicate TSRMLS_DC);
1481ZEND_API int add_property_zstrl_ex(zval *arg, char *key, uint key_len, zend_uchar type, zstr str, uint length, int duplicate TSRMLS_DC);
357
358#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
359#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
360#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b TSRMLS_CC)
361#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r TSRMLS_CC)
362#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC)
363#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
364#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
1482
1483#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
1484#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
1485#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b TSRMLS_CC)
1486#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r TSRMLS_CC)
1487#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC)
1488#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
1489#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
365#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
1490#define add_property_ascii_string(__arg, __key, __str, __duplicate) add_property_ascii_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
1491#define add_property_ascii_stringl(__arg, __key, __str, __length, __duplicate) add_property_ascii_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
1492#define add_property_rt_string(__arg, __key, __str, __duplicate) add_property_rt_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
1493#define add_property_rt_stringl(__arg, __key, __str, __length, __duplicate) add_property_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
1494#define add_property_utf8_string(__arg, __key, __str, __duplicate) add_property_utf8_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
1495#define add_property_utf8_stringl(__arg, __key, __str, __length, __duplicate) add_property_utf8_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
1496#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
1497#define add_property_unicode(__arg, __key, __str, __duplicate) add_property_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
1498#define add_property_unicodel(__arg, __key, __str, __length, __duplicate) add_property_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
1499#define add_property_zstr(__arg, __key, __type, __str, __duplicate) add_property_zstr_ex(__arg, __key, strlen(__key)+1, __type, __str, __duplicate TSRMLS_CC)
1500#define add_property_zstrl(__arg, __key, __type, __str, __length, __duplicate) add_property_zstrl_ex(__arg, __key, strlen(__key)+1, __type, __str, __length, __duplicate TSRMLS_CC)
366
1501
367
368ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC);
369ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
370END_EXTERN_C()
371
372typedef struct _zend_fcall_info {
373 size_t size;
374 HashTable *function_table;
375 zval *function_name;

--- 8 unchanged lines hidden (view full) ---

384typedef struct _zend_fcall_info_cache {
385 zend_bool initialized;
386 zend_function *function_handler;
387 zend_class_entry *calling_scope;
388 zval **object_pp;
389} zend_fcall_info_cache;
390
391BEGIN_EXTERN_C()
1502ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC);
1503ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
1504END_EXTERN_C()
1505
1506typedef struct _zend_fcall_info {
1507 size_t size;
1508 HashTable *function_table;
1509 zval *function_name;

--- 8 unchanged lines hidden (view full) ---

1518typedef struct _zend_fcall_info_cache {
1519 zend_bool initialized;
1520 zend_function *function_handler;
1521 zend_class_entry *calling_scope;
1522 zval **object_pp;
1523} zend_fcall_info_cache;
1524
1525BEGIN_EXTERN_C()
1526ZEND_API extern zend_fcall_info empty_fcall_info;
392ZEND_API extern zend_fcall_info_cache empty_fcall_info_cache;
393
394/** Build zend_call_info/cache from a zval*
395 *
396 * Caller is responsible to provide a return value, otherwise the we will crash.
397 * fci->retval_ptr_ptr = NULL;
398 * In order to pass parameters the following members need to be set:
399 * fci->param_count = 0;
400 * fci->params = NULL;
1527ZEND_API extern zend_fcall_info_cache empty_fcall_info_cache;
1528
1529/** Build zend_call_info/cache from a zval*
1530 *
1531 * Caller is responsible to provide a return value, otherwise the we will crash.
1532 * fci->retval_ptr_ptr = NULL;
1533 * In order to pass parameters the following members need to be set:
1534 * fci->param_count = 0;
1535 * fci->params = NULL;
1536 * The callable_name argument may be NULL.
401 */
1537 */
402ZEND_API int zend_fcall_info_init(zval *callable, zend_fcall_info *fci, zend_fcall_info_cache *fcc TSRMLS_DC);
1538ZEND_API int zend_fcall_info_init(zval *callable, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *callable_name TSRMLS_DC);
403
1539
1540/** Clear argumens connected with zend_fcall_info *fci
1541 * If free_mem is not zero then the params array gets free'd as well
1542 */
1543ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem);
1544
1545/** Save current arguments from zend_fcall_info *fci
1546 * params array will be set to NULL
1547 */
1548ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval ****params);
1549
1550/** Free arguments connected with zend_fcall_info *fci andset back saved ones.
1551 */
1552ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval ***params);
1553
404/** Set or clear the arguments in the zend_call_info struct taking care of
405 * refcount. If args is NULL and arguments are set then those are cleared.
406 */
407ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC);
408
1554/** Set or clear the arguments in the zend_call_info struct taking care of
1555 * refcount. If args is NULL and arguments are set then those are cleared.
1556 */
1557ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC);
1558
1559/** Set arguments in the zend_fcall_info struct taking care of refcount.
1560 * If argc is 0 the arguments which are set will be cleared, else pass
1561 * a variable amount of zval** arguments.
1562 */
1563ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval ***argv);
1564
1565/** Set arguments in the zend_fcall_info struct taking care of refcount.
1566 * If argc is 0 the arguments which are set will be cleared, else pass
1567 * a variable amount of zval** arguments.
1568 */
1569ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_list *argv);
1570
1571/** Set arguments in the zend_fcall_info struct taking care of refcount.
1572 * If argc is 0 the arguments which are set will be cleared, else pass
1573 * a variable amount of zval** arguments.
1574 */
1575ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci TSRMLS_DC, int argc, ...);
1576
409/** Call a function using information created by zend_fcall_info_init()/args().
410 * If args is given then those replace the arguement info in fci is temporarily.
411 */
412ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval **retval, zval *args TSRMLS_DC);
413
414ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC);
415
1577/** Call a function using information created by zend_fcall_info_init()/args().
1578 * If args is given then those replace the arguement info in fci is temporarily.
1579 */
1580ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval **retval, zval *args TSRMLS_DC);
1581
1582ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC);
1583
416
417ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
418 zend_bool is_ref, int num_symbol_tables, ...);
419
420ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC);
1584ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
1585 zend_bool is_ref, int num_symbol_tables, ...);
1586
1587ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC);
1588ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC);
421
422ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
423
424#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
425
426ZEND_API ZEND_FUNCTION(display_disabled_function);
427ZEND_API ZEND_FUNCTION(display_disabled_class);
428END_EXTERN_C()
429
430#if ZEND_DEBUG
431#define CHECK_ZVAL_STRING(z) \
1589
1590ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
1591
1592#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
1593
1594ZEND_API ZEND_FUNCTION(display_disabled_function);
1595ZEND_API ZEND_FUNCTION(display_disabled_class);
1596END_EXTERN_C()
1597
1598#if ZEND_DEBUG
1599#define CHECK_ZVAL_STRING(z) \
432 if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val); }
1600 if (Z_STRVAL_P(z)[Z_STRLEN_P(z)] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); }
433#define CHECK_ZVAL_STRING_REL(z) \
1601#define CHECK_ZVAL_STRING_REL(z) \
434 if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC); }
1602 if (Z_STRVAL_P(z)[Z_STRLEN_P(z)] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); }
1603#define CHECK_ZVAL_UNICODE(z) \
1604 if (Z_USTRVAL_P(z)[Z_USTRLEN_P(z)] != 0 ) { zend_error(E_WARNING, "String is not zero-terminated"); }
1605#define CHECK_ZVAL_UNICODE_REL(z) \
1606 if (Z_USTRVAL_P(z)[Z_USTRLEN_P(z)] != 0) { zend_error(E_WARNING, "String is not zero-terminated (source: %s:%d)", ZEND_FILE_LINE_RELAY_C); }
435#else
436#define CHECK_ZVAL_STRING(z)
437#define CHECK_ZVAL_STRING_REL(z)
1607#else
1608#define CHECK_ZVAL_STRING(z)
1609#define CHECK_ZVAL_STRING_REL(z)
1610#define CHECK_ZVAL_UNICODE(z)
1611#define CHECK_ZVAL_UNICODE_REL(z)
438#endif
439
440#define ZVAL_RESOURCE(z, l) { \
441 Z_TYPE_P(z) = IS_RESOURCE; \
442 Z_LVAL_P(z) = l; \
443 }
444
445#define ZVAL_BOOL(z, b) { \

--- 11 unchanged lines hidden (view full) ---

457 }
458
459#define ZVAL_DOUBLE(z, d) { \
460 Z_TYPE_P(z) = IS_DOUBLE; \
461 Z_DVAL_P(z) = d; \
462 }
463
464#define ZVAL_STRING(z, s, duplicate) { \
1612#endif
1613
1614#define ZVAL_RESOURCE(z, l) { \
1615 Z_TYPE_P(z) = IS_RESOURCE; \
1616 Z_LVAL_P(z) = l; \
1617 }
1618
1619#define ZVAL_BOOL(z, b) { \

--- 11 unchanged lines hidden (view full) ---

1631 }
1632
1633#define ZVAL_DOUBLE(z, d) { \
1634 Z_TYPE_P(z) = IS_DOUBLE; \
1635 Z_DVAL_P(z) = d; \
1636 }
1637
1638#define ZVAL_STRING(z, s, duplicate) { \
465 const char *__s=(s); \
466 (z)->value.str.len = strlen(__s); \
467 (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):(char*)__s); \
468 (z)->type = IS_STRING; \
1639 const char *__s=(s); \
1640 Z_STRLEN_P(z) = strlen(__s); \
1641 Z_STRVAL_P(z) = (duplicate?estrndup(__s, Z_STRLEN_P(z)):(char*)__s); \
1642 Z_TYPE_P(z) = IS_STRING; \
469 }
470
471#define ZVAL_STRINGL(z, s, l, duplicate) { \
1643 }
1644
1645#define ZVAL_STRINGL(z, s, l, duplicate) { \
472 const char *__s=(s); int __l=l;\
473 (z)->value.str.len = __l; \
474 (z)->value.str.val = (duplicate?estrndup(__s, __l):(char*)__s); \
475 (z)->type = IS_STRING; \
1646 const char *__s=(s); int __l=l; \
1647 Z_STRLEN_P(z) = __l; \
1648 Z_STRVAL_P(z) = (duplicate?estrndup(__s, __l):(char*)__s); \
1649 Z_TYPE_P(z) = IS_STRING; \
476 }
477
1650 }
1651
478#define ZVAL_EMPTY_STRING(z) { \
479 (z)->value.str.len = 0; \
480 (z)->value.str.val = STR_EMPTY_ALLOC(); \
481 (z)->type = IS_STRING; \
1652#define ZVAL_ASCII_STRING(z, s, flags) { \
1653 if (UG(unicode)) { \
1654 char *__s = (char*)(s); \
1655 int __s_len = strlen(__s); \
1656 UChar *u_str = zend_ascii_to_unicode(__s, __s_len+1 ZEND_FILE_LINE_CC); \
1657 u_str[__s_len] = 0; \
1658 if ((flags) & ZSTR_AUTOFREE) { \
1659 efree(__s); \
1660 } \
1661 ZVAL_UNICODEL(z, u_str, __s_len, 0); \
1662 } else { \
1663 const char *__s=(s); \
1664 Z_STRLEN_P(z) = strlen(__s); \
1665 Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, Z_STRLEN_P(z)) :(char*) __s); \
1666 Z_TYPE_P(z) = IS_STRING; \
1667 } \
482 }
483
1668 }
1669
1670#define ZVAL_ASCII_STRINGL(z, s, l, flags) { \
1671 if (UG(unicode)) { \
1672 char *__s = (char*)(s); \
1673 int __s_len = (l); \
1674 UChar *u_str = zend_ascii_to_unicode((__s), (__s_len)+1 ZEND_FILE_LINE_CC); \
1675 u_str[__s_len] = 0; \
1676 if ((flags) & ZSTR_AUTOFREE) { \
1677 efree(__s); \
1678 } \
1679 ZVAL_UNICODEL(z, u_str, __s_len, 0); \
1680 } else { \
1681 const char *__s=(s); int __l=l; \
1682 Z_STRLEN_P(z) = __l; \
1683 Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, __l) : (char*)__s); \
1684 Z_TYPE_P(z) = IS_STRING; \
1685 } \
1686 }
1687
1688#define ZVAL_U_STRING(conv, z, s, flags) { \
1689 if (UG(unicode)) { \
1690 char *__s = (char *)(s); \
1691 int __s_len = strlen(__s); \
1692 UChar *u_str; \
1693 int u_len; \
1694 if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \
1695 ZVAL_UNICODEL(z, u_str, u_len, 0); \
1696 } \
1697 if ((flags) & ZSTR_AUTOFREE) { \
1698 efree(__s); \
1699 } \
1700 } else { \
1701 char *__s=(char *)(s); \
1702 Z_STRLEN_P(z) = strlen(__s); \
1703 Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, Z_STRLEN_P(z)) : (char*)__s); \
1704 Z_TYPE_P(z) = IS_STRING; \
1705 } \
1706 }
1707
1708#define ZVAL_U_STRINGL(conv, z, s, l, flags) { \
1709 if (UG(unicode)) { \
1710 char *__s = (char *)(s); \
1711 int __s_len = (l); \
1712 UChar *u_str; \
1713 int u_len; \
1714 if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \
1715 ZVAL_UNICODEL(z, u_str, u_len, 0); \
1716 } \
1717 if ((flags) & ZSTR_AUTOFREE) { \
1718 efree(__s); \
1719 } \
1720 } else { \
1721 char *__s=(char *)(s); int __l=l; \
1722 Z_STRLEN_P(z) = __l; \
1723 Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, __l) : __s); \
1724 Z_TYPE_P(z) = IS_STRING; \
1725 } \
1726 }
1727
1728#define ZVAL_RT_STRING(z, s, flags) \
1729 ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), z, s, flags)
1730
1731#define ZVAL_RT_STRINGL(z, s, l, flags) \
1732 ZVAL_U_STRINGL(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), z, s, l, flags)
1733
1734#define ZVAL_UTF8_STRING(z, s, flags) \
1735 ZVAL_U_STRING(UG(utf8_conv), z, s, flags)
1736
1737#define ZVAL_UTF8_STRINGL(z, s, l, flags) \
1738 ZVAL_U_STRINGL(UG(utf8_conv), z, s, l, flags)
1739
1740#define ZVAL_UNICODE(z, u, duplicate) { \
1741 UChar *__u=(u); \
1742 Z_USTRLEN_P(z) = u_strlen(__u); \
1743 Z_USTRVAL_P(z) = (duplicate?eustrndup(__u, Z_USTRLEN_P(z)):__u); \
1744 Z_TYPE_P(z) = IS_UNICODE; \
1745 }
1746
1747#define ZVAL_UNICODEL(z, u, l, duplicate) { \
1748 UChar *__u=(u); int __l=l; \
1749 Z_USTRLEN_P(z) = __l; \
1750 Z_USTRVAL_P(z) = (duplicate?eustrndup(__u, __l):__u); \
1751 Z_TYPE_P(z) = IS_UNICODE; \
1752 }
1753
1754#define ZVAL_ZSTR(z, type, zs, duplicate) { \
1755 zstr __s=(zs); \
1756 Z_UNILEN_P(z) = ZSTR_LEN(type, __s); \
1757 Z_UNIVAL_P(z) = ZSTR(duplicate? \
1758 ((type==IS_UNICODE)? \
1759 (void*)eustrndup(__s.u, Z_UNILEN_P(z)) \
1760 :(void*)estrndup(__s.s, Z_UNILEN_P(z))) \
1761 :__s.v); \
1762 Z_TYPE_P(z) = type; \
1763 }
1764
1765#define ZVAL_ZSTRL(z, type, zs, l, duplicate) { \
1766 zstr __s=(zs); int __l=l; \
1767 Z_UNILEN_P(z) = __l; \
1768 Z_UNIVAL_P(z) = ZSTR(duplicate? \
1769 ((type==IS_UNICODE)? \
1770 (void*)eustrndup(__s.u, __l) \
1771 :(void*)estrndup(__s.s, __l)) \
1772 :__s.v); \
1773 Z_TYPE_P(z) = type; \
1774 }
1775
1776#define ZVAL_UCHAR32(z, ch) { \
1777 UChar buf[3]; \
1778 int buf_len = zend_codepoint_to_uchar(ch, buf); \
1779 ZVAL_UNICODEL(z, buf, buf_len, 1); \
1780 }
1781
1782#define ZVAL_EMPTY_STRING(z) { \
1783 Z_STRLEN_P(z) = 0; \
1784 Z_STRVAL_P(z) = STR_EMPTY_ALLOC(); \
1785 Z_TYPE_P(z) = IS_STRING; \
1786 }
1787
1788#define ZVAL_EMPTY_UNICODE(z) { \
1789 Z_USTRLEN_P(z) = 0; \
1790 Z_USTRVAL_P(z) = USTR_MAKE(""); \
1791 Z_TYPE_P(z) = IS_UNICODE; \
1792 }
1793
484#define ZVAL_ZVAL(z, zv, copy, dtor) { \
485 int is_ref, refcount; \
486 is_ref = (z)->is_ref; \
487 refcount = (z)->refcount; \
488 *(z) = *(zv); \
489 if (copy) { \
490 zval_copy_ctor(z); \
491 } \
492 if (dtor) { \
493 if (!copy) { \
494 ZVAL_NULL(zv); \
495 } \
496 zval_ptr_dtor(&zv); \
497 } \
498 (z)->is_ref = is_ref; \
499 (z)->refcount = refcount; \
500 }
501
1794#define ZVAL_ZVAL(z, zv, copy, dtor) { \
1795 int is_ref, refcount; \
1796 is_ref = (z)->is_ref; \
1797 refcount = (z)->refcount; \
1798 *(z) = *(zv); \
1799 if (copy) { \
1800 zval_copy_ctor(z); \
1801 } \
1802 if (dtor) { \
1803 if (!copy) { \
1804 ZVAL_NULL(zv); \
1805 } \
1806 zval_ptr_dtor(&zv); \
1807 } \
1808 (z)->is_ref = is_ref; \
1809 (z)->refcount = refcount; \
1810 }
1811
1812#define ZVAL_TEXT(z, t, duplicate) \
1813 do { \
1814 if (UG(unicode)) { \
1815 ZVAL_UNICODE(z, t.u, duplicate); \
1816 } else { \
1817 ZVAL_STRING(z, t.s, duplicate); \
1818 } \
1819 } while (0);
1820
1821#define ZVAL_TEXTL(z, t, l, duplicate) \
1822 do { \
1823 if (UG(unicode)) { \
1824 ZVAL_UNICODEL(z, t.u, l, duplicate);\
1825 } else { \
1826 ZVAL_STRINGL(z, t.s, l, duplicate); \
1827 } \
1828 } while (0);
1829
1830#define ZVAL_EMPTY_TEXT(z) \
1831 if (UG(unicode)) { \
1832 ZVAL_EMPTY_UNICODE(z); \
1833 } else { \
1834 ZVAL_EMPTY_STRING(z); \
1835 }
1836
1837#define ZVAL_ENC_STRINGL(z, t, conv, s, l, flags) { \
1838 if (t == IS_UNICODE) { \
1839 char *__s = (char *)(s); \
1840 int __s_len = (l); \
1841 UChar *u_str; \
1842 int u_len; \
1843 if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \
1844 ZVAL_UNICODEL(z, u_str, u_len, 0); \
1845 } \
1846 if ((flags) & ZSTR_AUTOFREE) { \
1847 efree(__s); \
1848 } \
1849 } else { \
1850 char *__s=(char *)(s); int __l=l; \
1851 Z_STRLEN_P(z) = __l; \
1852 Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, __l) : __s); \
1853 Z_TYPE_P(z) = IS_STRING; \
1854 } \
1855 }
1856
1857#define ZVAL_ENC_STRING(z, t, conv, s, flags) { \
1858 if (t == IS_UNICODE) { \
1859 char *__s = (char *)(s); \
1860 int __s_len = strlen(__s); \
1861 UChar *u_str; \
1862 int u_len; \
1863 if (zend_string_to_unicode(conv, &u_str, &u_len, __s, __s_len TSRMLS_CC) == SUCCESS) { \
1864 ZVAL_UNICODEL(z, u_str, u_len, 0); \
1865 } \
1866 if ((flags) & ZSTR_AUTOFREE) { \
1867 efree(__s); \
1868 } \
1869 } else { \
1870 char *__s=(char *)(s); \
1871 Z_STRLEN_P(z) = strlen(__s); \
1872 Z_STRVAL_P(z) = (((flags) & ZSTR_DUPLICATE) ? estrndup(__s, Z_STRLEN_P(z)) : __s); \
1873 Z_TYPE_P(z) = IS_STRING; \
1874 } \
1875 }
1876
502#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
503#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
504
505#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
506#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
507#define RETVAL_NULL() ZVAL_NULL(return_value)
508#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
509#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
510#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
511#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
1877#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
1878#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
1879
1880#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
1881#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
1882#define RETVAL_NULL() ZVAL_NULL(return_value)
1883#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
1884#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
1885#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
1886#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
1887#define RETVAL_ASCII_STRING(s, flags) ZVAL_ASCII_STRING(return_value, s, flags)
1888#define RETVAL_ASCII_STRINGL(s, l, flags) ZVAL_ASCII_STRINGL(return_value, s, l, flags)
1889#define RETVAL_U_STRING(conv, s, flags) ZVAL_U_STRING(conv, return_value, s, flags)
1890#define RETVAL_U_STRINGL(conv, s, l, flags) ZVAL_U_STRINGL(conv, return_value, s, l, flags)
1891#define RETVAL_RT_STRING(s, flags) ZVAL_RT_STRING(return_value, s, flags)
1892#define RETVAL_RT_STRINGL(s, l, flags) ZVAL_RT_STRINGL(return_value, s, l, flags)
1893#define RETVAL_UTF8_STRING(s, flags) ZVAL_UTF8_STRING(return_value, s, flags)
1894#define RETVAL_UTF8_STRINGL(s, l, flags) ZVAL_UTF8_STRINGL(return_value, s, l, flags)
512#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
1895#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
1896#define RETVAL_UNICODE(u, duplicate) ZVAL_UNICODE(return_value, u, duplicate)
1897#define RETVAL_UNICODEL(u, l, duplicate) ZVAL_UNICODEL(return_value, u, l, duplicate)
1898#define RETVAL_UCHAR32(ch) ZVAL_UCHAR32(return_value, ch)
1899#define RETVAL_EMPTY_UNICODE() ZVAL_EMPTY_UNICODE(return_value)
513#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
514#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
515#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
1900#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
1901#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
1902#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
1903#define RETVAL_TEXT(t, duplicate) ZVAL_TEXT(return_value, t, duplicate)
1904#define RETVAL_TEXTL(t, l, duplicate) ZVAL_TEXTL(return_value, t, l, duplicate)
1905#define RETVAL_EMPTY_TEXT() ZVAL_EMPTY_TEXT(return_value)
1906#define RETVAL_ZSTR(type, s, duplicate) ZVAL_ZSTR(return_value, type, s, duplicate)
1907#define RETVAL_ZSTRL(type, s, l, duplicate) ZVAL_ZSTRL(return_value, type, s, l, duplicate)
1908#define RETVAL_ENC_STRINGL(type, conv, s, l, flags) ZVAL_ENC_STRINGL(return_value, type, conv, s, l, flags)
1909#define RETVAL_ENC_STRING(type, conv, s, flags) ZVAL_ENC_STRING(return_value, type, conv, s, flags)
516
517#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
518#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
519#define RETURN_NULL() { RETVAL_NULL(); return;}
520#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
521#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
522#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
523#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
524#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
1910
1911#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
1912#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
1913#define RETURN_NULL() { RETVAL_NULL(); return;}
1914#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
1915#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
1916#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
1917#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
1918#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
1919#define RETURN_UNICODE(u, duplicate) { RETVAL_UNICODE(u, duplicate); return; }
1920#define RETURN_UNICODEL(u, l, duplicate) { RETVAL_UNICODEL(u, l, duplicate); return; }
1921#define RETURN_UCHAR32(ch) { RETVAL_UCHAR32(ch); return; }
1922#define RETURN_EMPTY_UNICODE() { RETVAL_EMPTY_UNICODE(); return; }
525#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
526#define RETURN_FALSE { RETVAL_FALSE; return; }
527#define RETURN_TRUE { RETVAL_TRUE; return; }
1923#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
1924#define RETURN_FALSE { RETVAL_FALSE; return; }
1925#define RETURN_TRUE { RETVAL_TRUE; return; }
1926#define RETURN_TEXT(t, duplicate) { RETVAL_TEXT(t, duplicate); return; }
1927#define RETURN_TEXTL(t, l, duplicate) { RETVAL_TEXTL(t, l, duplicate); return; }
1928#define RETURN_EMPTY_TEXT() { RETVAL_EMPTY_TEXT(); return; }
1929#define RETURN_ASCII_STRING(t, flags) { RETVAL_ASCII_STRING(t, flags); return; }
1930#define RETURN_ASCII_STRINGL(t, l, flags) { RETVAL_ASCII_STRINGL(t, l, flags); return; }
1931#define RETURN_U_STRING(conv, t, flags) { RETVAL_U_STRING(conv, t, flags); return; }
1932#define RETURN_U_STRINGL(conv, t, l, flags) { RETVAL_U_STRINGL(conv, t, l, flags); return; }
1933#define RETURN_RT_STRING(t, flags) { RETVAL_RT_STRING(t, flags); return; }
1934#define RETURN_RT_STRINGL(t, l, flags) { RETVAL_RT_STRINGL(t, l, flags); return; }
1935#define RETURN_UTF8_STRING(t, flags) { RETVAL_UTF8_STRING(t, flags); return; }
1936#define RETURN_UTF8_STRINGL(t, l, flags) { RETVAL_UTF8_STRINGL(t, l, flags); return; }
1937#define RETURN_ZSTR(type, s, duplicate) { RETVAL_ZSTR(type, s, duplicate); return; }
1938#define RETURN_ZSTRL(type, s, l, duplicate) { RETVAL_ZSTRL(type, s, l, duplicate); return; }
1939#define RETURN_ENC_STRINGL(type, conv, s, l, flags) { RETVAL_ENC_STRINGL(type, conv, s, l, flags); return; }
1940#define RETURN_ENC_STRING(type, conv, s, flags) { RETVAL_ENC_STRING(type, conv, s, flags); return; }
528
529#define SET_VAR_STRING(n, v) { \
530 { \
531 zval *var; \
532 ALLOC_ZVAL(var); \
533 ZVAL_STRING(var, v, 0); \
534 ZEND_SET_GLOBAL_VAR(n, var); \
535 } \
536 }
537
538#define SET_VAR_STRINGL(n, v, l) { \
539 { \
540 zval *var; \
541 ALLOC_ZVAL(var); \
542 ZVAL_STRINGL(var, v, l, 0); \
543 ZEND_SET_GLOBAL_VAR(n, var); \
544 } \
545 }
546
1941
1942#define SET_VAR_STRING(n, v) { \
1943 { \
1944 zval *var; \
1945 ALLOC_ZVAL(var); \
1946 ZVAL_STRING(var, v, 0); \
1947 ZEND_SET_GLOBAL_VAR(n, var); \
1948 } \
1949 }
1950
1951#define SET_VAR_STRINGL(n, v, l) { \
1952 { \
1953 zval *var; \
1954 ALLOC_ZVAL(var); \
1955 ZVAL_STRINGL(var, v, l, 0); \
1956 ZEND_SET_GLOBAL_VAR(n, var); \
1957 } \
1958 }
1959
1960#define SET_VAR_ASCII_STRINGL(n, v, l) { \
1961 { \
1962 zval *var; \
1963 ALLOC_ZVAL(var); \
1964 ZVAL_ASCII_STRINGL(var, v, l, ZSTR_AUTOFREE); \
1965 ZEND_SET_GLOBAL_VAR(n, var); \
1966 } \
1967 }
1968
547#define SET_VAR_LONG(n, v) { \
548 { \
549 zval *var; \
550 ALLOC_ZVAL(var); \
551 ZVAL_LONG(var, v); \
552 ZEND_SET_GLOBAL_VAR(n, var); \
553 } \
554 }

--- 10 unchanged lines hidden (view full) ---

565
566#define ZEND_SET_SYMBOL(symtable, name, var) \
567 { \
568 char *_name = (name); \
569 \
570 ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \
571 }
572
1969#define SET_VAR_LONG(n, v) { \
1970 { \
1971 zval *var; \
1972 ALLOC_ZVAL(var); \
1973 ZVAL_LONG(var, v); \
1974 ZEND_SET_GLOBAL_VAR(n, var); \
1975 } \
1976 }

--- 10 unchanged lines hidden (view full) ---

1987
1988#define ZEND_SET_SYMBOL(symtable, name, var) \
1989 { \
1990 char *_name = (name); \
1991 \
1992 ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \
1993 }
1994
1995#define ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, type, name, name_length, var, _refcount, _is_ref) \
1996 { \
1997 zval **orig_var; \
1998 \
1999 if (zend_u_hash_find(symtable, (type), (name), (name_length), (void **) &orig_var)==SUCCESS \
2000 && PZVAL_IS_REF(*orig_var)) { \
2001 (var)->refcount = (*orig_var)->refcount; \
2002 (var)->is_ref = 1; \
2003 \
2004 if (_refcount) { \
2005 (var)->refcount += _refcount-1; \
2006 } \
2007 zval_dtor(*orig_var); \
2008 **orig_var = *(var); \
2009 FREE_ZVAL(var); \
2010 } else { \
2011 (var)->is_ref = _is_ref; \
2012 if (_refcount) { \
2013 (var)->refcount = _refcount; \
2014 } \
2015 zend_u_hash_update(symtable, (type), (name), (name_length), &(var), sizeof(zval *), NULL); \
2016 } \
2017 }
2018
573#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
574 { \
575 zval **orig_var; \
576 \
2019#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
2020 { \
2021 zval **orig_var; \
2022 \
577 if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
2023 if (zend_rt_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
578 && PZVAL_IS_REF(*orig_var)) { \
579 (var)->refcount = (*orig_var)->refcount; \
580 (var)->is_ref = 1; \
581 \
582 if (_refcount) { \
583 (var)->refcount += _refcount-1; \
584 } \
585 zval_dtor(*orig_var); \
586 **orig_var = *(var); \
587 FREE_ZVAL(var); \
588 } else { \
589 (var)->is_ref = _is_ref; \
590 if (_refcount) { \
591 (var)->refcount = _refcount; \
592 } \
2024 && PZVAL_IS_REF(*orig_var)) { \
2025 (var)->refcount = (*orig_var)->refcount; \
2026 (var)->is_ref = 1; \
2027 \
2028 if (_refcount) { \
2029 (var)->refcount += _refcount-1; \
2030 } \
2031 zval_dtor(*orig_var); \
2032 **orig_var = *(var); \
2033 FREE_ZVAL(var); \
2034 } else { \
2035 (var)->is_ref = _is_ref; \
2036 if (_refcount) { \
2037 (var)->refcount = _refcount; \
2038 } \
593 zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \
2039 zend_rt_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \
594 } \
595 }
596
2040 } \
2041 }
2042
597
598#define ZEND_SET_GLOBAL_VAR(name, var) \
599 ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
600
601#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
602 ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
603
604#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \
605{ \

--- 37 unchanged lines hidden ---
2043#define ZEND_SET_GLOBAL_VAR(name, var) \
2044 ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
2045
2046#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
2047 ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref)
2048
2049#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \
2050{ \

--- 37 unchanged lines hidden ---