- cleanup
authorMichael Wallner <mike@php.net>
Thu, 22 Dec 2005 11:25:40 +0000 (11:25 +0000)
committerMichael Wallner <mike@php.net>
Thu, 22 Dec 2005 11:25:40 +0000 (11:25 +0000)
http_request_pool_api.c
php_http_std_defs.h

index a24f7328e26dffd5d64556d6cd8dcb92eace7a28..306333071b4704a6c990b82705ae150714d272df 100644 (file)
@@ -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){
index dbc6473301752a84c88f3d5b1e348de9d369f7bd..61a55639238c32c975b32b03e6f4e219974bf85c 100644 (file)
@@ -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)