summaryrefslogtreecommitdiff
path: root/Zend/zend_stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_stack.c')
-rw-r--r--Zend/zend_stack.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c
index 0f3b0f6aac..011e8519c9 100644
--- a/Zend/zend_stack.c
+++ b/Zend/zend_stack.c
@@ -118,38 +118,46 @@ ZEND_API int zend_stack_count(zend_stack *stack)
}
-ZEND_API void zend_stack_apply(zend_stack *stack, void (*apply_function)(void *element), int type)
+ZEND_API void zend_stack_apply(zend_stack *stack, int (*apply_function)(void *element), int type)
{
int i;
switch (type) {
case ZEND_STACK_APPLY_TOPDOWN:
for (i=stack->top-1; i>=0; i--) {
- apply_function(stack->elements[i]);
+ if (apply_function(stack->elements[i])) {
+ break;
+ }
}
break;
case ZEND_STACK_APPLY_BOTTOMUP:
for (i=0; i<stack->top; i++) {
- apply_function(stack->elements[i]);
+ if (apply_function(stack->elements[i])) {
+ break;
+ }
}
break;
}
}
-ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, void (*apply_function)(void *element, void *arg), int type, void *arg)
+ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int (*apply_function)(void *element, void *arg), int type, void *arg)
{
int i;
switch (type) {
case ZEND_STACK_APPLY_TOPDOWN:
for (i=stack->top-1; i>=0; i--) {
- apply_function(stack->elements[i], arg);
+ if (apply_function(stack->elements[i], arg)) {
+ break;
+ }
}
break;
case ZEND_STACK_APPLY_BOTTOMUP:
for (i=0; i<stack->top; i++) {
- apply_function(stack->elements[i], arg);
+ if (apply_function(stack->elements[i], arg)) {
+ break;
+ }
}
break;
}