File: libkmod-array.h

package info (click to toggle)
kmod 18-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,092 kB
  • ctags: 1,586
  • sloc: ansic: 13,387; xml: 1,848; makefile: 430; sh: 209; python: 7
file content (20 lines) | stat: -rw-r--r-- 630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

/*
 * Declaration of struct array is in header because we may want to embed the
 * structure into another, so we need to know its size
 */
struct array {
	void **array;
	size_t count;
	size_t total;
	size_t step;
};

void array_init(struct array *array, size_t step);
int array_append(struct array *array, const void *element);
int array_append_unique(struct array *array, const void *element);
void array_pop(struct array *array);
void array_free_array(struct array *array);
void array_sort(struct array *array, int (*cmp)(const void *a, const void *b));
int array_remove_at(struct array *array, unsigned int pos);