diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2016-05-23 02:08:28 +0000 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2016-05-23 02:08:28 +0000 |
commit | 9a2915ce6603bfcd3de99f3111fe56cc2b4f02bd (patch) | |
tree | 76b9c8a518efc84a09b4fde9051bc8c85eb871a5 /arraylist.c | |
parent | b2c5969affa90414a2a20291909c33bcd9ab19cd (diff) | |
parent | 92e9a5032bc38ffef09b33991f035a423d5f79a4 (diff) | |
download | json-c-9a2915ce6603bfcd3de99f3111fe56cc2b4f02bd.tar.gz |
Merge branch 'fixes-for-upstream' of https://github.com/doctaweeks/json-c into doctaweeks-fixes-for-upstream
Diffstat (limited to 'arraylist.c')
-rw-r--r-- | arraylist.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arraylist.c b/arraylist.c index 1789ad2..a02266e 100644 --- a/arraylist.c +++ b/arraylist.c @@ -44,7 +44,7 @@ array_list_new(array_list_free_fn *free_fn) extern void array_list_free(struct array_list *arr) { - int i; + size_t i; for(i = 0; i < arr->length; i++) if(arr->array[i]) arr->free_fn(arr->array[i]); free(arr->array); @@ -52,16 +52,16 @@ array_list_free(struct array_list *arr) } void* -array_list_get_idx(struct array_list *arr, int i) +array_list_get_idx(struct array_list *arr, size_t i) { if(i >= arr->length) return NULL; return arr->array[i]; } -static int array_list_expand_internal(struct array_list *arr, int max) +static int array_list_expand_internal(struct array_list *arr, size_t max) { void *t; - int new_size; + size_t new_size; if(max < arr->size) return 0; /* Avoid undefined behaviour on int32 overflow */ @@ -82,7 +82,7 @@ static int array_list_expand_internal(struct array_list *arr, int max) } int -array_list_put_idx(struct array_list *arr, int idx, void *data) +array_list_put_idx(struct array_list *arr, size_t idx, void *data) { if( idx < 0 || idx > INT_MAX - 1 ) return -1; if(array_list_expand_internal(arr, idx+1)) return -1; @@ -111,7 +111,7 @@ void* array_list_bsearch(const void **key, struct array_list *arr, sort_fn); } -int +size_t array_list_length(struct array_list *arr) { return arr->length; |