qbarray.h(3)

qbarray.h3

This is a dynamic array (it can grow, but without moving memory).

Usage

#include <qb/qbarray.h>

Overview

arr = qb_array_create_2(64, sizeof(struct my_struct), 256);
...
res = qb_array_index(arr, idx, (void**)&my_ptr);
if (res < 0) {
     return res;
}
// use my_ptr, now even if there is a grow, this pointer will be valid.

Currently, this dynamic array abstract data type can accommodate only 2^QB_ARRAY_MAX_INDEX_BITS elements, and with standard zero-based indexing, this gives a valid index range [0, QB_ARRAY_MAX_ELEMENTS), where the notation denotes the beginning of the interval is included and the end is excluded. In other words, client space shall avoid a pitfall of relying solely on the type of max_elements parameter to qb_array_create and/or of idx parameter to qb_array_index (these types conflict, anyway).

Releases

8 releases since Debian 7 (Wheezy); the text changed 6 times.

  1. 7–8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13
  7. Arch

From libqb 2.0.10-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.