summaryrefslogtreecommitdiff
path: root/Zend/zend_ptr_stack.c
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 19:39:21 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 19:39:21 -0400
commit6821b67124604da690c5e9276d5370d679c63ac8 (patch)
treebefb4ca2520eb577950cef6cb76d10b914cbf67a /Zend/zend_ptr_stack.c
parentcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (diff)
downloadphp-6821b67124604da690c5e9276d5370d679c63ac8.tar.gz
Imported Upstream version 5.3.0RC1upstream/5.3.0_RC1upstream/5.3.0RC1
Diffstat (limited to 'Zend/zend_ptr_stack.c')
-rw-r--r--Zend/zend_ptr_stack.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c
index 74150e052..54296c740 100644
--- a/Zend/zend_ptr_stack.c
+++ b/Zend/zend_ptr_stack.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.3 2008/12/31 11:17:33 sebastian Exp $ */
+/* $Id: zend_ptr_stack.c,v 1.23.2.1.2.1.2.3 2008/12/31 11:15:32 sebastian 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_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;