summaryrefslogtreecommitdiff
path: root/Zend/zend_stack.h
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-04-30 20:28:02 +0200
committerNikita Popov <nikic@php.net>2014-05-01 09:08:29 +0200
commit5a03efe2790cc935d4d8ca723bd21ce8c079fbd4 (patch)
treed378f9fb31ab2bce4f70211df94b4403db55d5ca /Zend/zend_stack.h
parent257bf697ae9b2ae366f7f3726019c18ad92b9002 (diff)
downloadphp-git-5a03efe2790cc935d4d8ca723bd21ce8c079fbd4.tar.gz
Don't allocate zend_stack elements individually
Instead allocate a vector of elements. Size must now be specified on initialization rather than on push.
Diffstat (limited to 'Zend/zend_stack.h')
-rw-r--r--Zend/zend_stack.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h
index 851e2301aa..3932136aac 100644
--- a/Zend/zend_stack.h
+++ b/Zend/zend_stack.h
@@ -23,22 +23,22 @@
#define ZEND_STACK_H
typedef struct _zend_stack {
- int top, max;
- void **elements;
+ int size, top, max;
+ void *elements;
} zend_stack;
-#define STACK_BLOCK_SIZE 64
+#define STACK_BLOCK_SIZE 16
BEGIN_EXTERN_C()
-ZEND_API int zend_stack_init(zend_stack *stack);
-ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size);
+ZEND_API int zend_stack_init(zend_stack *stack, int size);
+ZEND_API int zend_stack_push(zend_stack *stack, const void *element);
ZEND_API int zend_stack_top(const zend_stack *stack, void **element);
ZEND_API int zend_stack_del_top(zend_stack *stack);
ZEND_API int zend_stack_int_top(const zend_stack *stack);
ZEND_API int zend_stack_is_empty(const zend_stack *stack);
ZEND_API int zend_stack_destroy(zend_stack *stack);
-ZEND_API void **zend_stack_base(const zend_stack *stack);
+ZEND_API void *zend_stack_base(const zend_stack *stack);
ZEND_API int zend_stack_count(const zend_stack *stack);
ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element));
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg);