1QBARRAY.H(3)               libqb Programmer's Manual              QBARRAY.H(3)
2
3
4

NAME

6       qbarray.h  -  This  is a dynamic array (it can grow, but without moving
7       memory).
8
9

SYNOPSIS

11       #include <qb/qbarray.h>
12

DESCRIPTION

14       arr = qb_array_create_2(64, sizeof(struct my_struct), 256);
15       ...
16       res = qb_array_index(arr, idx, (void**)&my_ptr);
17       if (res < 0) {
18            return res;
19       }
20       // use my_ptr, now even if there is a grow, this pointer will be valid.
21
22
23       Currently, this dynamic array abstract data type can  accommodate  only
24       2^QB_ARRAY_MAX_INDEX_BITS elements, and with standard zero-based index‐
25       ing, this gives a valid index range [0,  QB_ARRAY_MAX_ELEMENTS),  where
26       the  notation denotes the beginning of the interval is included and the
27       end is excluded. In other words, client space shall avoid a pitfall  of
28       relying solely on the type of max_elements parameter to qb_array_create
29       and/or of idx parameter to qb_array_index (these types  conflict,  any‐
30       way).
31

SEE ALSO

33       qb_array_elems_per_bin_get(3), qb_array_new_bin_cb_set(3),
34       qb_array_create(3), qb_array_grow(3), qb_array_num_bins_get(3),
35       qb_array_index(3), qb_array_create_2(3), qb_array_free(3)
36
38       Copyright (C) 2010-2020 Red Hat, Inc.
39
40
41
42LIBQB                             2021-11-12                      QBARRAY.H(3)
Impressum