diff options
author | Johannes Schlüter <johannes@php.net> | 2007-11-09 10:34:27 +0000 |
---|---|---|
committer | Johannes Schlüter <johannes@php.net> | 2007-11-09 10:34:27 +0000 |
commit | e6dff0caa47efee905207d4a2b2df9f24ae717d9 (patch) | |
tree | 033512a063f4ab90f32420e9f5e5f66ed4c9c9cb /Zend/zend_ptr_stack.c | |
parent | 7ab56f7a434199413299096d7227aa7508f07103 (diff) | |
download | php-git-e6dff0caa47efee905207d4a2b2df9f24ae717d9.tar.gz |
- MFH: Allow persistent zent_ptr_stacks (patch by Andrey Hristov)
Diffstat (limited to 'Zend/zend_ptr_stack.c')
-rw-r--r-- | Zend/zend_ptr_stack.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 36cb21c58b..d2bbbe0e69 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -25,11 +25,17 @@ # include <stdarg.h> #endif -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) +ZEND_API void zend_ptr_stack_init_ex(zend_ptr_stack *stack, zend_bool persistent) { - stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE); + stack->top_element = stack->elements = (void **) pemalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE, persistent); stack->max = PTR_STACK_BLOCK_SIZE; stack->top = 0; + stack->persistent = persistent; +} + +ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) +{ + zend_ptr_stack_init_ex(stack, 0); } @@ -71,7 +77,7 @@ ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count, ...) ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack) { if (stack->elements) { - efree(stack->elements); + pefree(stack->elements, stack->persistent); } } @@ -93,7 +99,7 @@ ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *), int i = stack->top; while (--i >= 0) { - efree(stack->elements[i]); + pefree(stack->elements[i], stack->persistent); } } stack->top = 0; |