Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / genalloc.h / genalloc_qsort_full.3.md

% limb manual
% genalloc_qsort_full(3)
% limb 0.1.0
% 2023-07-24

# NAME

genalloc_qsort_full, genalloc_qsort_r_full, genalloc_qsort, genalloc_qsort_r -
sort a genalloc using qsort/qsort_r

# SYNOPSIS

    #include <limb/genalloc.h>

```pre hl
int (*cmp_fn) (const void *<em>p1</em>, const void *<em>p2</em>);
int (*cmp_r_fn) (const void *<em>p1</em>, const void *<em>p2</em>, void *<em>ctx</em>);

void genalloc_qsort_full(<em>type</em>, genalloc *<em>ga</em>, size_t <em>from</em>, size_t <em>len</em>, cmp_fn <em>cmp</em>)
void genalloc_qsort_r_full(<em>type</em>, genalloc *<em>ga</em>, size_t <em>from</em>, size_t <em>len</em>, cmp_r_fn <em>cmp_r</em>, void *<em>ctx</em>)

void genalloc_qsort(<em>type</em>, genalloc *<em>ga</em>,  cmp_fn <em>cmp</em>)
void genalloc_qsort_r(<em>type</em>, genalloc *<em>ga</em>,  cmp_r_fn <em>cmp_r</em>, void *<em>ctx</em>)
```

# DESCRIPTION

The `genalloc_qsort_full`() macro sorts `len` elements of the *genalloc* pointed
by `ga`, starting at element `from` (counting from 0), using [qsort](3) with
comparison function pointed to by `cmp`.

The `genalloc_qsort_r_full`() macro is similar to `genalloc_qsort_full`() but
using [qsort_r](3) with comparison function pointed to by `cmp_r` which will
receive `ctx` as its third argument.

For more information about comparison functions, refer to [qsort](3) and
[qsort_r](3).

The `genalloc_qsort`() macro is similar to `genalloc_qsort_full`() but to sort
the full array.

The `genalloc_qsort_r`() macro is similar to `genalloc_qsort_r_full`() but to
sort the full array.