Skip to content

Commit 110c17f

Browse files
committed
fix size types
1 parent 9d972d3 commit 110c17f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Zend/zend_stack.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ZEND_API int zend_stack_init(zend_stack *stack)
3030
return SUCCESS;
3131
}
3232

33-
ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size)
33+
ZEND_API zend_size_t zend_stack_push(zend_stack *stack, const void *element, zend_size_t size)
3434
{
3535
if (stack->top >= stack->max) { /* we need to allocate more memory */
3636
stack->elements = (void **) erealloc(stack->elements,
@@ -90,7 +90,7 @@ ZEND_API int zend_stack_is_empty(const zend_stack *stack)
9090

9191
ZEND_API int zend_stack_destroy(zend_stack *stack)
9292
{
93-
int i;
93+
zend_size_t i;
9494

9595
if (stack->elements) {
9696
for (i = 0; i < stack->top; i++) {
@@ -110,19 +110,19 @@ ZEND_API void **zend_stack_base(const zend_stack *stack)
110110
}
111111

112112

113-
ZEND_API int zend_stack_count(const zend_stack *stack)
113+
ZEND_API zend_size_t zend_stack_count(const zend_stack *stack)
114114
{
115115
return stack->top;
116116
}
117117

118118

119119
ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element))
120120
{
121-
int i;
121+
zend_size_t i;
122122

123123
switch (type) {
124124
case ZEND_STACK_APPLY_TOPDOWN:
125-
for (i=stack->top-1; i>=0; i--) {
125+
for (i=stack->top-1; i < ZEND_SIZE_MAX; i--) {
126126
if (apply_function(stack->elements[i])) {
127127
break;
128128
}
@@ -141,11 +141,11 @@ ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function
141141

142142
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg)
143143
{
144-
int i;
144+
zend_size_t i;
145145

146146
switch (type) {
147147
case ZEND_STACK_APPLY_TOPDOWN:
148-
for (i=stack->top-1; i>=0; i--) {
148+
for (i = stack->top - 1; i < ZEND_SIZE_MAX; i--) {
149149
if (apply_function(stack->elements[i], arg)) {
150150
break;
151151
}

Zend/zend_stack.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define ZEND_STACK_H
2424

2525
typedef struct _zend_stack {
26-
int top, max;
26+
zend_size_t top, max;
2727
void **elements;
2828
} zend_stack;
2929

@@ -32,14 +32,14 @@ typedef struct _zend_stack {
3232

3333
BEGIN_EXTERN_C()
3434
ZEND_API int zend_stack_init(zend_stack *stack);
35-
ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size);
35+
ZEND_API zend_size_t zend_stack_push(zend_stack *stack, const void *element, zend_size_t size);
3636
ZEND_API int zend_stack_top(const zend_stack *stack, void **element);
3737
ZEND_API int zend_stack_del_top(zend_stack *stack);
3838
ZEND_API int zend_stack_int_top(const zend_stack *stack);
3939
ZEND_API int zend_stack_is_empty(const zend_stack *stack);
4040
ZEND_API int zend_stack_destroy(zend_stack *stack);
4141
ZEND_API void **zend_stack_base(const zend_stack *stack);
42-
ZEND_API int zend_stack_count(const zend_stack *stack);
42+
ZEND_API zend_size_t zend_stack_count(const zend_stack *stack);
4343
ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element));
4444
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg);
4545
END_EXTERN_C()

0 commit comments

Comments
 (0)