21 qunique(
void *array,
size_t elements,
size_t width,
22 int (*
compare) (
const void *,
const void *))
24 char *bytes = (
char *) array;
31 for (
i = 1,
j = 0;
i < elements; ++
i)
33 if (
compare(bytes +
i * width, bytes +
j * width) != 0 &&
35 memcpy(bytes +
j * width, bytes +
i * width, width);
47 int (*
compare) (
const void *,
const void *,
void *),
50 char *bytes = (
char *) array;
57 for (
i = 1,
j = 0;
i < elements; ++
i)
59 if (
compare(bytes +
i * width, bytes +
j * width,
arg) != 0 &&
61 memcpy(bytes +
j * width, bytes +
i * width, width);
static int compare(const void *arg1, const void *arg2)
static size_t qunique(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *))
static size_t qunique_arg(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *, void *), void *arg)