From: Michael Wallner Date: Thu, 22 Dec 2005 11:25:40 +0000 (+0000) Subject: - cleanup X-Git-Tag: RELEASE_0_21_0~46 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=604c0e53f847efab109d18068894a2ca7fc55df5;p=m6w6%2Fext-http - cleanup --- diff --git a/http_request_pool_api.c b/http_request_pool_api.c index a24f732..3063330 100644 --- a/http_request_pool_api.c +++ b/http_request_pool_api.c @@ -317,14 +317,17 @@ void _http_request_pool_wrap_exception(zval *old_exception, zval *new_exception /* if old_exception is already an HttpRequestPoolException append the new one, else create a new HttpRequestPoolException and append the old and new exceptions */ if (old_exception && Z_OBJCE_P(old_exception) == ce) { - zval *exprop; + zval *old_exprop, *new_exprop; - exprop = zend_read_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), 0 TSRMLS_CC); - SEP_PROP(&exprop); - convert_to_array(exprop); - - add_next_index_zval(exprop, new_exception); - zend_update_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), exprop TSRMLS_CC); + MAKE_STD_ZVAL(new_exprop); + array_init(new_exprop); + old_exprop = zend_read_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), 0 TSRMLS_CC); + if (Z_TYPE_P(old_exprop) == IS_ARRAY) { + array_copy(old_exprop, new_exprop); + } + add_next_index_zval(new_exprop, new_exception); + zend_update_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), new_exprop TSRMLS_CC); + zval_ptr_dtor(&new_exprop); EG(exception) = old_exception; } else if (new_exception && Z_OBJCE_P(new_exception) != ce){ diff --git a/php_http_std_defs.h b/php_http_std_defs.h index dbc6473..61a5563 100644 --- a/php_http_std_defs.h +++ b/php_http_std_defs.h @@ -181,11 +181,12 @@ typedef int STATUS; if (Z_TYPE_PP(tmp) != IS_ARRAY) { \ convert_to_array_ex(tmp); \ } \ + ZVAL_ADDREF(*data); \ add_next_index_zval(*tmp, *data); \ } else { \ + ZVAL_ADDREF(*data); \ add_assoc_zval(dst, key, *data); \ } \ - ZVAL_ADDREF(*data); \ key = NULL; \ } \ } \ @@ -261,34 +262,6 @@ typedef int STATUS; # define ACC_PROP_PUBLIC(flags) (flags & ZEND_ACC_PUBLIC) # define ACC_PROP(ce, flags) (ACC_PROP_PUBLIC(flags) || ACC_PROP_PRIVATE(ce, flags) || ACC_PROP_PROTECTED(ce, flags)) -# define INIT_PARR(o, n) \ - { \ - zval *__tmp; \ - MAKE_STD_ZVAL(__tmp); \ - array_init(__tmp); \ - SET_PROP(o, n, __tmp); \ - } - -# define FREE_PARR(o, p) \ - { \ - zval *__tmp = GET_PROP(o, p); \ - if (__tmp) { \ - zval_ptr_dtor(&__tmp); \ - } \ - } - -/* - * the property *MUST* be updated after SEP_PROP() - */ -# define SEP_PROP(zpp) \ - { \ - zval **op = zpp; \ - SEPARATE_ZVAL_IF_NOT_REF(zpp); \ - if (op != zpp) { \ - zval_ptr_dtor(op); \ - } \ - } - # define SET_EH_THROW() SET_EH_THROW_EX(zend_exception_get_default()) # define SET_EH_THROW_HTTP() SET_EH_THROW_EX(http_exception_get_default()) # define SET_EH_THROW_EX(ex) php_set_error_handling(EH_THROW, ex TSRMLS_CC)