2e575a38d86bc6f9c339c049f7fa44e976050dbe
[m6w6/ext-http] / php_http_std_defs.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2006, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #ifndef PHP_HTTP_STD_DEFS_H
16 #define PHP_HTTP_STD_DEFS_H
17
18 #if defined(PHP_WIN32)
19 # if defined(HTTP_EXPORTS)
20 # define PHP_HTTP_API __declspec(dllexport)
21 # elif defined(COMPILE_DL_HTTP)
22 # define PHP_HTTP_API __declspec(dllimport)
23 # else
24 # define PHP_HTTP_API
25 # endif
26 #else
27 # define PHP_HTTP_API
28 #endif
29
30 /* make functions that return SUCCESS|FAILURE more obvious */
31 typedef int STATUS;
32
33 /* lenof() */
34 #define lenof(S) (sizeof(S) - 1)
35
36 #ifndef MIN
37 # define MIN(a,b) (a<b?a:b)
38 #endif
39 #ifndef MAX
40 # define MAX(a,b) (a>b?a:b)
41 #endif
42
43 /* STR_SET() */
44 #ifndef STR_SET
45 # define STR_SET(STR, SET) \
46 { \
47 STR_FREE(STR); \
48 STR = SET; \
49 }
50 #endif
51
52 #define INIT_ZARR(zv, ht) \
53 { \
54 INIT_PZVAL(&(zv)); \
55 Z_TYPE(zv) = IS_ARRAY; \
56 Z_ARRVAL(zv) = (ht); \
57 }
58
59 /* return bool (v == SUCCESS) */
60 #define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
61 #define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
62 /* return object(values) */
63 #define RETVAL_OBJECT(o, addref) \
64 RETVAL_OBJVAL((o)->value.obj, addref)
65 #define RETURN_OBJECT(o, addref) \
66 RETVAL_OBJECT(o, addref); \
67 return
68 #define RETVAL_OBJVAL(ov, addref) \
69 ZVAL_OBJVAL(return_value, ov, addref)
70 #define RETURN_OBJVAL(ov, addref) \
71 RETVAL_OBJVAL(ov, addref); \
72 return
73 #define ZVAL_OBJVAL(zv, ov, addref) \
74 (zv)->type = IS_OBJECT; \
75 (zv)->value.obj = (ov);\
76 if (addref && Z_OBJ_HT_P(zv)->add_ref) { \
77 Z_OBJ_HT_P(zv)->add_ref((zv) TSRMLS_CC); \
78 }
79 /* return property */
80 #define RETVAL_PROP(n) RETVAL_PROP_EX(getThis(), n)
81 #define RETURN_PROP(n) RETURN_PROP_EX(getThis(), n)
82 #define RETVAL_PROP_EX(this, n) \
83 { \
84 zval *__prop = GET_PROP_EX(this, n); \
85 RETVAL_ZVAL(__prop, 1, 0); \
86 }
87 #define RETURN_PROP_EX(this, n) \
88 { \
89 zval *__prop = GET_PROP_EX(this, n); \
90 RETURN_ZVAL(__prop, 1, 0); \
91 }
92
93 /* function accepts no args */
94 #define NO_ARGS \
95 if (ZEND_NUM_ARGS()) { \
96 zend_error(E_NOTICE, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C)); \
97 }
98
99 /* check if return value is used */
100 #define IF_RETVAL_USED \
101 if (!return_value_used) { \
102 return; \
103 } else
104
105 /* CR LF */
106 #define HTTP_CRLF "\r\n"
107
108 /* default cache control */
109 #define HTTP_DEFAULT_CACHECONTROL "private, must-revalidate, max-age=0"
110
111 /* max URL length */
112 #define HTTP_URL_MAXLEN 4096
113
114 /* def URL arg separator */
115 #define HTTP_URL_ARGSEP "&"
116
117 /* send buffer size */
118 #define HTTP_SENDBUF_SIZE 40960
119
120 /* CURL buffer size */
121 #define HTTP_CURLBUF_SIZE 16384
122
123 /* known methods */
124 #define HTTP_KNOWN_METHODS \
125 /* HTTP 1.1 */ \
126 "GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT, " \
127 /* WebDAV - RFC 2518 */ \
128 "PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, " \
129 /* WebDAV Versioning - RFC 3253 */ \
130 "VERSION-CONTROL, REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, " \
131 "MKWORKSPACE, UPDATE, LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, " \
132 /* WebDAV Access Control - RFC 3744 */ \
133 "ACL, " \
134 /* END */
135
136 #ifdef ZEND_ENGINE_2
137 # include "ext/standard/file.h"
138 # define HTTP_DEFAULT_STREAM_CONTEXT FG(default_context)
139 #else
140 # define HTTP_DEFAULT_STREAM_CONTEXT NULL
141 #endif
142
143 #define HTTP_PHP_INI_ENTRY(entry, default, scope, updater, global) \
144 STD_PHP_INI_ENTRY(entry, default, scope, updater, global, zend_http_globals, http_globals)
145 #define HTTP_PHP_INI_ENTRY_EX(entry, default, scope, updater, displayer, global) \
146 STD_PHP_INI_ENTRY_EX(entry, default, scope, updater, global, zend_http_globals, http_globals, displayer)
147
148 /* {{{ arrays */
149 #define FOREACH_VAL(pos, array, val) FOREACH_HASH_VAL(pos, Z_ARRVAL_P(array), val)
150 #define FOREACH_HASH_VAL(pos, hash, val) \
151 for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \
152 zend_hash_get_current_data_ex(hash, (void **) &val, &pos) == SUCCESS; \
153 zend_hash_move_forward_ex(hash, &pos))
154
155 #define FOREACH_KEY(pos, array, strkey, numkey) FOREACH_HASH_KEY(pos, Z_ARRVAL_P(array), strkey, numkey)
156 #define FOREACH_HASH_KEY(pos, hash, strkey, numkey) \
157 for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \
158 zend_hash_get_current_key_ex(hash, &strkey, NULL, &numkey, 0, &pos) != HASH_KEY_NON_EXISTANT; \
159 zend_hash_move_forward_ex(hash, &pos)) \
160
161 #define FOREACH_KEYLEN(pos, array, strkey, keylen, numkey) FOREACH_HASH_KEYLEN(pos, Z_ARRVAL_P(array), strkey, keylen, numkey)
162 #define FOREACH_HASH_KEYLEN(pos, hash, strkey, keylen, numkey) \
163 for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \
164 zend_hash_get_current_key_ex(hash, &strkey, &keylen, &numkey, 0, &pos) != HASH_KEY_NON_EXISTANT; \
165 zend_hash_move_forward_ex(hash, &pos)) \
166
167 #define FOREACH_KEYVAL(pos, array, strkey, numkey, val) FOREACH_HASH_KEYVAL(pos, Z_ARRVAL_P(array), strkey, numkey, val)
168 #define FOREACH_HASH_KEYVAL(pos, hash, strkey, numkey, val) \
169 for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \
170 zend_hash_get_current_key_ex(hash, &strkey, NULL, &numkey, 0, &pos) != HASH_KEY_NON_EXISTANT && \
171 zend_hash_get_current_data_ex(hash, (void **) &val, &pos) == SUCCESS; \
172 zend_hash_move_forward_ex(hash, &pos))
173
174 #define FOREACH_KEYLENVAL(pos, array, strkey, keylen, numkey, val) FOREACH_HASH_KEYLENVAL(pos, Z_ARRVAL_P(array), strkey, keylen, numkey, val)
175 #define FOREACH_HASH_KEYLENVAL(pos, hash, strkey, keylen, numkey, val) \
176 for ( zend_hash_internal_pointer_reset_ex(hash, &pos); \
177 zend_hash_get_current_key_ex(hash, &strkey, &keylen, &numkey, 0, &pos) != HASH_KEY_NON_EXISTANT && \
178 zend_hash_get_current_data_ex(hash, (void **) &val, &pos) == SUCCESS; \
179 zend_hash_move_forward_ex(hash, &pos))
180
181 #define array_copy(src, dst) zend_hash_copy(Z_ARRVAL_P(dst), Z_ARRVAL_P(src), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *))
182 #define array_merge(src, dst) zend_hash_merge(Z_ARRVAL_P(dst), Z_ARRVAL_P(src), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *), 1)
183 #define array_append(src, dst) \
184 { \
185 ulong idx; \
186 uint klen; \
187 char *key = NULL; \
188 zval **data; \
189 HashPosition pos; \
190 \
191 for ( zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(src), &pos); \
192 zend_hash_get_current_key_ex(Z_ARRVAL_P(src), &key, &klen, &idx, 0, &pos) != HASH_KEY_NON_EXISTANT && \
193 zend_hash_get_current_data_ex(Z_ARRVAL_P(src), (void **) &data, &pos) == SUCCESS; \
194 zend_hash_move_forward_ex(Z_ARRVAL_P(src), &pos)) \
195 { \
196 if (key) { \
197 zval **tmp; \
198 \
199 if (SUCCESS == zend_hash_find(Z_ARRVAL_P(dst), key, klen, (void **) &tmp)) { \
200 if (Z_TYPE_PP(tmp) != IS_ARRAY) { \
201 convert_to_array_ex(tmp); \
202 } \
203 ZVAL_ADDREF(*data); \
204 add_next_index_zval(*tmp, *data); \
205 } else { \
206 ZVAL_ADDREF(*data); \
207 add_assoc_zval(dst, key, *data); \
208 } \
209 key = NULL; \
210 } \
211 } \
212 }
213 /* }}} */
214
215 #define HTTP_LONG_CONSTANT(name, const) REGISTER_LONG_CONSTANT(name, const, CONST_CS | CONST_PERSISTENT)
216
217 /* {{{ objects & properties */
218 #ifdef ZEND_ENGINE_2
219
220 # define HTTP_STATIC_ME_ALIAS(me, al, ai) ZEND_FENTRY(me, ZEND_FN(al), ai, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
221
222 # define HTTP_REGISTER_CLASS_EX(classname, name, parent, flags) \
223 { \
224 zend_class_entry ce; \
225 memset(&ce, 0, sizeof(zend_class_entry)); \
226 INIT_CLASS_ENTRY(ce, #classname, name## _fe); \
227 ce.create_object = _ ##name## _new; \
228 name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
229 name## _ce->ce_flags |= flags; \
230 memcpy(& name## _handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
231 name## _declare_default_properties(); \
232 }
233
234 # define HTTP_REGISTER_CLASS(classname, name, parent, flags) \
235 { \
236 zend_class_entry ce; \
237 memset(&ce, 0, sizeof(zend_class_entry)); \
238 INIT_CLASS_ENTRY(ce, #classname, name## _fe); \
239 ce.create_object = NULL; \
240 name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
241 name## _ce->ce_flags |= flags; \
242 }
243
244 # define HTTP_REGISTER_EXCEPTION(classname, cename, parent) \
245 { \
246 zend_class_entry ce; \
247 memset(&ce, 0, sizeof(zend_class_entry)); \
248 INIT_CLASS_ENTRY(ce, #classname, NULL); \
249 ce.create_object = NULL; \
250 cename = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
251 }
252
253 # define getObject(t, o) getObjectEx(t, o, getThis())
254 # define getObjectEx(t, o, v) t * o = ((t *) zend_object_store_get_object(v TSRMLS_CC))
255 # define putObject(t, o) zend_objects_store_put(o, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) _ ##t## _free, NULL TSRMLS_CC);
256 # define OBJ_PROP(o) (o)->zo.properties
257
258 # define DCL_STATIC_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
259 # define DCL_STATIC_PROP_Z(a, n, v) zend_declare_property(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
260 # define DCL_STATIC_PROP_N(a, n) zend_declare_property_null(ce, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC)
261 # define GET_STATIC_PROP_EX(ce, n) zend_std_get_static_property(ce, (#n), sizeof(#n)-1, 0 TSRMLS_CC)
262 # define UPD_STATIC_PROP_EX(ce, t, n, v) zend_update_static_property_ ##t(ce, #n, sizeof(#n)-1, (v) TSRMLS_CC)
263 # define UPD_STATIC_STRL_EX(ce, n, v, l) zend_update_static_property_stringl(ce, #n, sizeof(#n)-1, (v), (l) TSRMLS_CC)
264 # define SET_STATIC_PROP_EX(ce, n, v) zend_update_static_property(ce, #n, sizeof(#n)-1, v TSRMLS_CC)
265
266 # define DCL_PROP(a, t, n, v) zend_declare_property_ ##t(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC)
267 # define DCL_PROP_Z(a, n, v) zend_declare_property(ce, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC)
268 # define DCL_PROP_N(a, n) zend_declare_property_null(ce, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a) TSRMLS_CC)
269 # define UPD_PROP(t, n, v) UPD_PROP_EX(getThis(), t, n, v)
270 # define UPD_PROP_EX(this, t, n, v) zend_update_property_ ##t(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, (v) TSRMLS_CC)
271 # define UPD_STRL(n, v, l) zend_update_property_stringl(OBJ_PROP_CE, getThis(), (#n), sizeof(#n)-1, (v), (l) TSRMLS_CC)
272 # define SET_PROP(n, z) SET_PROP_EX(getThis(), n, z)
273 # define SET_PROP_EX(this, n, z) zend_update_property(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, (z) TSRMLS_CC)
274 # define GET_PROP(n) GET_PROP_EX(getThis(), n)
275 # define GET_PROP_EX(this, n) zend_read_property(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, 0 TSRMLS_CC)
276
277 # define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(ce, (n), sizeof(n)-1, (v) TSRMLS_CC)
278
279 # define ACC_PROP_PRIVATE(ce, flags) ((flags & ZEND_ACC_PRIVATE) && (EG(scope) && ce == EG(scope))
280 # define ACC_PROP_PROTECTED(ce, flags) ((flags & ZEND_ACC_PROTECTED) && (zend_check_protected(ce, EG(scope))))
281 # define ACC_PROP_PUBLIC(flags) (flags & ZEND_ACC_PUBLIC)
282 # define ACC_PROP(ce, flags) (ACC_PROP_PUBLIC(flags) || ACC_PROP_PRIVATE(ce, flags) || ACC_PROP_PROTECTED(ce, flags))
283
284 # define SET_EH_THROW() SET_EH_THROW_EX(zend_exception_get_default())
285 # define SET_EH_THROW_HTTP() SET_EH_THROW_EX(http_exception_get_default())
286 # define SET_EH_THROW_EX(ex) php_set_error_handling(EH_THROW, ex TSRMLS_CC)
287 # define SET_EH_NORMAL() php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC)
288
289 #endif /* ZEND_ENGINE_2 */
290 /* }}} */
291
292 #ifndef E_THROW
293 # define E_THROW 0
294 #endif
295 #ifdef ZEND_ENGINE_2
296 # define HE_THROW E_THROW TSRMLS_CC
297 # define HE_NOTICE (HTTP_G->only_exceptions ? E_THROW : E_NOTICE) TSRMLS_CC
298 # define HE_WARNING (HTTP_G->only_exceptions ? E_THROW : E_WARNING) TSRMLS_CC
299 # define HE_ERROR (HTTP_G->only_exceptions ? E_THROW : E_ERROR) TSRMLS_CC
300 #else
301 # define HE_THROW E_WARNING TSRMLS_CC
302 # define HE_NOTICE E_NOTICE TSRMLS_CC
303 # define HE_WARNING E_WARNING TSRMLS_CC
304 # define HE_ERROR E_ERROR TSRMLS_CC
305 #endif
306
307 #define HTTP_E_RUNTIME 1L
308 #define HTTP_E_INVALID_PARAM 2L
309 #define HTTP_E_HEADER 3L
310 #define HTTP_E_MALFORMED_HEADERS 4L
311 #define HTTP_E_REQUEST_METHOD 5L
312 #define HTTP_E_MESSAGE_TYPE 6L
313 #define HTTP_E_ENCODING 7L
314 #define HTTP_E_REQUEST 8L
315 #define HTTP_E_REQUEST_POOL 9L
316 #define HTTP_E_SOCKET 10L
317 #define HTTP_E_RESPONSE 11L
318 #define HTTP_E_URL 12L
319 #define HTTP_E_QUERYSTRING 13L
320
321 #ifdef ZEND_ENGINE_2
322 # define HTTP_BEGIN_ARGS_EX(class, method, ret_ref, req_args) static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 0, ret_ref, req_args)
323 # define HTTP_BEGIN_ARGS_AR(class, method, ret_ref, req_args) static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 1, ret_ref, req_args)
324 # define HTTP_END_ARGS }
325 # define HTTP_EMPTY_ARGS_EX(class, method, ret_ref) HTTP_BEGIN_ARGS_EX(class, method, ret_ref, 0) HTTP_END_ARGS
326 # define HTTP_ARGS(class, method) args_for_ ##class## _ ##method
327 # define HTTP_ARG_VAL(name, pass_ref) ZEND_ARG_INFO(pass_ref, name)
328 # define HTTP_ARG_OBJ(class, name, allow_null) ZEND_ARG_OBJ_INFO(0, name, class, allow_null)
329 #endif
330
331 #ifdef ZEND_ENGINE_2
332 # define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}
333 #else
334 # define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL}
335 #endif
336
337 #ifdef HTTP_HAVE_CURL
338 # ifdef ZEND_ENGINE_2
339 # define HTTP_DECLARE_ARG_PASS_INFO() \
340 static \
341 ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \
342 ZEND_ARG_PASS_INFO(0) \
343 ZEND_ARG_PASS_INFO(1) \
344 ZEND_END_ARG_INFO(); \
345 \
346 static \
347 ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_3, 0) \
348 ZEND_ARG_PASS_INFO(0) \
349 ZEND_ARG_PASS_INFO(0) \
350 ZEND_ARG_PASS_INFO(1) \
351 ZEND_END_ARG_INFO(); \
352 \
353 static \
354 ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_4, 0) \
355 ZEND_ARG_PASS_INFO(0) \
356 ZEND_ARG_PASS_INFO(0) \
357 ZEND_ARG_PASS_INFO(0) \
358 ZEND_ARG_PASS_INFO(1) \
359 ZEND_END_ARG_INFO(); \
360 \
361 static \
362 ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_5, 0) \
363 ZEND_ARG_PASS_INFO(0) \
364 ZEND_ARG_PASS_INFO(0) \
365 ZEND_ARG_PASS_INFO(0) \
366 ZEND_ARG_PASS_INFO(0) \
367 ZEND_ARG_PASS_INFO(1) \
368 ZEND_END_ARG_INFO();
369
370 # else
371 # define HTTP_DECLARE_ARG_PASS_INFO() \
372 static unsigned char http_arg_pass_ref_2[] = {2, BYREF_NONE, BYREF_FORCE}; \
373 static unsigned char http_arg_pass_ref_3[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE}; \
374 static unsigned char http_arg_pass_ref_4[] = {4, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE}; \
375 static unsigned char http_arg_pass_ref_5[] = {5, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE};
376 # endif /* ZEND_ENGINE_2 */
377 #else
378 # ifdef ZEND_ENGINE_2
379 # define HTTP_DECLARE_ARG_PASS_INFO() \
380 static \
381 ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \
382 ZEND_ARG_PASS_INFO(0) \
383 ZEND_ARG_PASS_INFO(1) \
384 ZEND_END_ARG_INFO(); \
385 \
386 static \
387 ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_4, 0) \
388 ZEND_ARG_PASS_INFO(0) \
389 ZEND_ARG_PASS_INFO(0) \
390 ZEND_ARG_PASS_INFO(0) \
391 ZEND_ARG_PASS_INFO(1) \
392 ZEND_END_ARG_INFO();
393 # else
394 # define HTTP_DECLARE_ARG_PASS_INFO() \
395 static unsigned char http_arg_pass_ref_2[] = {2, BYREF_NONE, BYREF_FORCE}; \
396 static unsigned char http_arg_pass_ref_4[] = {4, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE};
397 # endif /* ZEND_ENGINE_2 */
398 #endif /* HTTP_HAVE_CURL */
399
400
401 #ifndef TSRMLS_FETCH_FROM_CTX
402 # ifdef ZTS
403 # define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
404 # else
405 # define TSRMLS_FETCH_FROM_CTX(ctx)
406 # endif
407 #endif
408
409 #ifndef TSRMLS_SET_CTX
410 # ifdef ZTS
411 # define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
412 # else
413 # define TSRMLS_SET_CTX(ctx)
414 # endif
415 #endif
416
417 #ifndef ZVAL_ZVAL
418 #define ZVAL_ZVAL(z, zv, copy, dtor) { \
419 int is_ref, refcount; \
420 is_ref = (z)->is_ref; \
421 refcount = (z)->refcount; \
422 *(z) = *(zv); \
423 if (copy) { \
424 zval_copy_ctor(z); \
425 } \
426 if (dtor) { \
427 if (!copy) { \
428 ZVAL_NULL(zv); \
429 } \
430 zval_ptr_dtor(&zv); \
431 } \
432 (z)->is_ref = is_ref; \
433 (z)->refcount = refcount; \
434 }
435 #endif
436 #ifndef RETVAL_ZVAL
437 #define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
438 #endif
439 #ifndef RETURN_ZVAL
440 #define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
441 #endif
442
443 #define PHP_MINIT_CALL(func) PHP_MINIT(func)(INIT_FUNC_ARGS_PASSTHRU)
444 #define PHP_RINIT_CALL(func) PHP_RINIT(func)(INIT_FUNC_ARGS_PASSTHRU)
445 #define PHP_MSHUTDOWN_CALL(func) PHP_MSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
446 #define PHP_RSHUTDOWN_CALL(func) PHP_RSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
447
448 #define Z_OBJ_DELREF(z) \
449 if (Z_OBJ_HT(z)->del_ref) { \
450 Z_OBJ_HT(z)->del_ref(&(z) TSRMLS_CC); \
451 }
452 #define Z_OBJ_ADDREF(z) \
453 if (Z_OBJ_HT(z)->add_ref) { \
454 Z_OBJ_HT(z)->add_ref(&(z) TSRMLS_CC); \
455 }
456 #define Z_OBJ_DELREF_P(z) \
457 if (Z_OBJ_HT_P(z)->del_ref) { \
458 Z_OBJ_HT_P(z)->del_ref((z) TSRMLS_CC); \
459 }
460 #define Z_OBJ_ADDREF_P(z) \
461 if (Z_OBJ_HT_P(z)->add_ref) { \
462 Z_OBJ_HT_P(z)->add_ref((z) TSRMLS_CC); \
463 }
464 #define Z_OBJ_DELREF_PP(z) \
465 if (Z_OBJ_HT_PP(z)->del_ref) { \
466 Z_OBJ_HT_PP(z)->del_ref(*(z) TSRMLS_CC); \
467 }
468 #define Z_OBJ_ADDREF_PP(z) \
469 if (Z_OBJ_HT_PP(z)->add_ref) { \
470 Z_OBJ_HT_PP(z)->add_ref(*(z) TSRMLS_CC); \
471 }
472
473 #endif /* PHP_HTTP_STD_DEFS_H */
474
475 /*
476 * Local variables:
477 * tab-width: 4
478 * c-basic-offset: 4
479 * End:
480 * vim600: noet sw=4 ts=4 fdm=marker
481 * vim<600: noet sw=4 ts=4
482 */
483