cvs: ZendEngine2(PHP_5_3) / zend_ptr_stack.c zend_ptr_stack.h

From: Date: Fri, 09 Nov 2007 10:34:27 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend_ptr_stack.c zend_ptr_stack.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6139@lists.php.net to get a copy of this message
johannes Fri Nov 9 10:34:27 2007 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2 zend_ptr_stack.c zend_ptr_stack.h Log: - MFH: Allow persistent zent_ptr_stacks (patch by Andrey Hristov) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ptr_stack.c?r1=1.23.2.1.2.1&r2=1.23.2.1.2.1.2.1&diff_format=u Index: ZendEngine2/zend_ptr_stack.c diff -u ZendEngine2/zend_ptr_stack.c:1.23.2.1.2.1 ZendEngine2/zend_ptr_stack.c:1.23.2.1.2.1.2.1 --- ZendEngine2/zend_ptr_stack.c:1.23.2.1.2.1 Mon Jan 1 09:35:47 2007 +++ ZendEngine2/zend_ptr_stack.c Fri Nov 9 10:34:27 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.1 2007/01/01 09:35:47 sebastian Exp $ */ +/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.1.2.1 2007/11/09 10:34:27 johannes Exp $ */ #include "zend.h" #include "zend_ptr_stack.h" @@ -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_destroy(zend_ptr_stack *stack) { if (stack->elements) { - efree(stack->elements); + pefree(stack->elements, stack->persistent); } } @@ -93,7 +99,7 @@ int i = stack->top; while (--i >= 0) { - efree(stack->elements[i]); + pefree(stack->elements[i], stack->persistent); } } stack->top = 0; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ptr_stack.h?r1=1.22.2.2.2.1&r2=1.22.2.2.2.1.2.1&diff_format=u Index: ZendEngine2/zend_ptr_stack.h diff -u ZendEngine2/zend_ptr_stack.h:1.22.2.2.2.1 ZendEngine2/zend_ptr_stack.h:1.22.2.2.2.1.2.1 --- ZendEngine2/zend_ptr_stack.h:1.22.2.2.2.1 Mon Jan 1 09:35:47 2007 +++ ZendEngine2/zend_ptr_stack.h Fri Nov 9 10:34:27 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ptr_stack.h,v 1.22.2.2.2.1 2007/01/01 09:35:47 sebastian Exp $ */ +/* $Id: zend_ptr_stack.h,v 1.22.2.2.2.1.2.1 2007/11/09 10:34:27 johannes Exp $ */ #ifndef ZEND_PTR_STACK_H #define ZEND_PTR_STACK_H @@ -26,6 +26,7 @@ int top, max; void **elements; void **top_element; + zend_bool persistent; } zend_ptr_stack; @@ -33,6 +34,7 @@ BEGIN_EXTERN_C() 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); ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count, ...); 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); @@ -46,7 +48,7 @@ /* we need to allocate more memory */ \ stack->max *= 2; \ stack->max += count; \ - stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max))); \ + stack->elements = (void **) perealloc(stack->elements, (sizeof(void *) * (stack->max)), stack->persistent); \ stack->top_element = stack->elements+stack->top; \ }

« previous php.zend-engine.cvs (#6139) next »