com php-src: fix size types: Zend/zend_stack.c Zend/zend _stack.h

From: Date: Sat, 08 Feb 2014 19:05:49 +0000
Subject: com php-src: fix size types: Zend/zend_stack.c Zend/zend _stack.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75935@lists.php.net to get a copy of this message
Commit: 110c17f8b8b1cac9d04bf7a61dc7c04ba946f404 Author: Anatol Belski <ab@php.net> Sat, 8 Feb 2014 20:05:49 +0100 Parents: 9d972d3956fbbf217e1c654838d150ffc5b9d112 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=110c17f8b8b1cac9d04bf7a61dc7c04ba946f404 Log: fix size types Changed paths: M Zend/zend_stack.c M Zend/zend_stack.h Diff: diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c index cf99499..c700c97 100644 --- a/Zend/zend_stack.c +++ b/Zend/zend_stack.c @@ -30,7 +30,7 @@ ZEND_API int zend_stack_init(zend_stack *stack) return SUCCESS; } -ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size) +ZEND_API zend_size_t zend_stack_push(zend_stack *stack, const void *element, zend_size_t size) { if (stack->top >= stack->max) { /* we need to allocate more memory */ stack->elements = (void **) erealloc(stack->elements, @@ -90,7 +90,7 @@ ZEND_API int zend_stack_is_empty(const zend_stack *stack) ZEND_API int zend_stack_destroy(zend_stack *stack) { - int i; + zend_size_t i; if (stack->elements) { for (i = 0; i < stack->top; i++) { @@ -110,7 +110,7 @@ ZEND_API void **zend_stack_base(const zend_stack *stack) } -ZEND_API int zend_stack_count(const zend_stack *stack) +ZEND_API zend_size_t zend_stack_count(const zend_stack *stack) { return stack->top; } @@ -118,11 +118,11 @@ 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)) { - int i; + zend_size_t i; switch (type) { case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { + for (i=stack->top-1; i < ZEND_SIZE_MAX; i--) { if (apply_function(stack->elements[i])) { break; } @@ -141,11 +141,11 @@ ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg) { - int i; + zend_size_t i; switch (type) { case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { + for (i = stack->top - 1; i < ZEND_SIZE_MAX; i--) { if (apply_function(stack->elements[i], arg)) { break; } diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h index d484879..93b6ccb 100644 --- a/Zend/zend_stack.h +++ b/Zend/zend_stack.h @@ -23,7 +23,7 @@ #define ZEND_STACK_H typedef struct _zend_stack { - int top, max; + zend_size_t top, max; void **elements; } zend_stack; @@ -32,14 +32,14 @@ typedef struct _zend_stack { 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 zend_size_t zend_stack_push(zend_stack *stack, const void *element, zend_size_t size); 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 int zend_stack_count(const zend_stack *stack); +ZEND_API zend_size_t 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); END_EXTERN_C()

« previous php.cvs (#75935) next »