]>
Commit | Line | Data |
---|---|---|
e8fd8fec | 1 | #pragma once |
6670c633 | 2 | |
74d1df66 LDM |
3 | #include <stddef.h> |
4 | ||
6670c633 LDM |
5 | /* |
6 | * Declaration of struct array is in header because we may want to embed the | |
7 | * structure into another, so we need to know its size | |
8 | */ | |
9 | struct array { | |
10 | void **array; | |
11 | size_t count; | |
12 | size_t total; | |
13 | size_t step; | |
14 | }; | |
15 | ||
16 | void array_init(struct array *array, size_t step); | |
17 | int array_append(struct array *array, const void *element); | |
18 | int array_append_unique(struct array *array, const void *element); | |
19 | void array_pop(struct array *array); | |
20 | void array_free_array(struct array *array); | |
21 | void array_sort(struct array *array, int (*cmp)(const void *a, const void *b)); | |
79b656fa | 22 | int array_remove_at(struct array *array, unsigned int pos); |