]> git.ipfire.org Git - thirdparty/kmod.git/blame - shared/array.h
libkmod: Handle long lines in /proc/modules
[thirdparty/kmod.git] / shared / array.h
CommitLineData
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 */
9struct array {
10 void **array;
11 size_t count;
12 size_t total;
13 size_t step;
14};
15
16void array_init(struct array *array, size_t step);
17int array_append(struct array *array, const void *element);
18int array_append_unique(struct array *array, const void *element);
19void array_pop(struct array *array);
20void array_free_array(struct array *array);
21void array_sort(struct array *array, int (*cmp)(const void *a, const void *b));
79b656fa 22int array_remove_at(struct array *array, unsigned int pos);