Skip to content

Commit 04c464d

Browse files
MaxKellermannnikic
authored andcommitted
apc_stack: use size_t instead of int where appropriate
1 parent e52ce6c commit 04c464d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

apc_stack.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030

3131
struct apc_stack_t {
3232
void** data;
33-
int capacity;
34-
int size;
33+
size_t capacity;
34+
size_t size;
3535
};
3636

37-
apc_stack_t* apc_stack_create(int size_hint)
37+
apc_stack_t* apc_stack_create(size_t size_hint)
3838
{
3939
apc_stack_t* stack = emalloc(sizeof(apc_stack_t));
4040

@@ -81,7 +81,7 @@ void* apc_stack_top(apc_stack_t* stack)
8181
return stack->data[stack->size-1];
8282
}
8383

84-
void* apc_stack_get(apc_stack_t* stack, int n)
84+
void* apc_stack_get(apc_stack_t* stack, size_t n)
8585
{
8686
assert(stack != NULL && stack->size > n);
8787
return stack->data[n];

apc_stack.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
#define T apc_stack_t*
3535
typedef struct apc_stack_t apc_stack_t; /* opaque stack type */
3636

37-
extern T apc_stack_create(int size_hint);
37+
extern T apc_stack_create(size_t size_hint);
3838
extern void apc_stack_destroy(T stack);
3939
extern void apc_stack_clear(T stack);
4040
extern void apc_stack_push(T stack, void* item);
4141
extern void* apc_stack_pop(T stack);
4242
extern void* apc_stack_top(T stack);
43-
extern void* apc_stack_get(T stack, int n);
43+
extern void* apc_stack_get(T stack, size_t n);
4444
extern int apc_stack_size(T stack);
4545

4646
#undef T

0 commit comments

Comments
 (0)