diff options
Diffstat (limited to 'src/arraylist.c')
| -rw-r--r-- | src/arraylist.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arraylist.c b/src/arraylist.c index 0db35ad..7a62fd4 100644 --- a/src/arraylist.c +++ b/src/arraylist.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | typedef int T; | 11 | typedef int T; |
| 12 | 12 | ||
| 13 | struct ArrayList { | 13 | struct ArrayList { |
| 14 | T ** array; | 14 | T **array; |
| 15 | size_t size; | 15 | size_t size; |
| 16 | size_t capacity; | 16 | size_t capacity; |
| 17 | }; | 17 | }; |
| @@ -83,7 +83,7 @@ ArrayList_growIfNeeded(struct ArrayList *arrayList) | |||
| 83 | } | 83 | } |
| 84 | else { | 84 | else { |
| 85 | size_t new_capacity = arrayList->capacity * 3 / 2; // *= 1.5 | 85 | size_t new_capacity = arrayList->capacity * 3 / 2; // *= 1.5 |
| 86 | T ** new_arrayList = ArrayList_allocateArray(arrayList->array, new_capacity); | 86 | T **new_arrayList = ArrayList_allocateArray(arrayList->array, new_capacity); |
| 87 | 87 | ||
| 88 | arrayList->capacity = new_capacity; | 88 | arrayList->capacity = new_capacity; |
| 89 | arrayList->array = new_arrayList; | 89 | arrayList->array = new_arrayList; |
| @@ -225,7 +225,7 @@ static int | |||
| 225 | ArrayList_bsearchHelper(const void *ctx, const void *el) | 225 | ArrayList_bsearchHelper(const void *ctx, const void *el) |
| 226 | { | 226 | { |
| 227 | const struct bsearchHelper_context *context = ctx; | 227 | const struct bsearchHelper_context *context = ctx; |
| 228 | const const_T_ptr * element = el; | 228 | const const_T_ptr *element = el; |
| 229 | 229 | ||
| 230 | return context->cmp(context->key, *element, context->args); | 230 | return context->cmp(context->key, *element, context->args); |
| 231 | } | 231 | } |
| @@ -245,7 +245,7 @@ ArrayList_binarySearch(struct ArrayList *arrayList, void *key, int cmp(void *, c | |||
| 245 | 245 | ||
| 246 | T **pos = bsearch(&context, arrayList->array, arrayList->size, sizeof arrayList->array[0], ArrayList_bsearchHelper); | 246 | T **pos = bsearch(&context, arrayList->array, arrayList->size, sizeof arrayList->array[0], ArrayList_bsearchHelper); |
| 247 | if ( pos ) { | 247 | if ( pos ) { |
| 248 | *loc = (size_t)(pos - arrayList->array); | 248 | *loc = (size_t) (pos - arrayList->array); |
| 249 | return true; | 249 | return true; |
| 250 | } | 250 | } |
| 251 | else { | 251 | else { |
