diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2024-12-05 15:05:04 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2024-12-05 15:06:10 -0500 |
| commit | 74bf6a57c3c852d8b5237f2b5920556c63da1d79 (patch) | |
| tree | 0379d5f64a6e09127cc137941d6452f2fbb0f98e /pk.h.in | |
| parent | 42d967bb6a674fe025a2ad8455bc49a8b93b9d20 (diff) | |
pkarr: first-pass
Diffstat (limited to 'pk.h.in')
| -rw-r--r-- | pk.h.in | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -27,6 +27,7 @@ * # define PK_IMPL_MEM * # define PK_IMPL_STR * # define PK_IMPL_EV +* # define PK_IMPL_ARR * #include "pk.h" * ``` * @@ -119,6 +120,26 @@ * that in this provided scenario a given mgr will still grow if a second EV is * registered. * +******************************************************************************** +* pkarr.h: def PK_IMPL_ARR before including pk.h to enable ad-hoc +* +* Provides a structure for managing contiguous lists +* +* The following definitions (shown with defaults) can be overridden: +* PK_ARR_INITIAL_COUNT 16 +* PK_ARR_GROW_RATIO 1.5 +* +* Initialize `stride`, `alignment` (optional), and `bkt` (optional) members +* *before* calling any `pk_arr_*` methods. +* ``` c +* struct pk_arr arr = {0}; +* arr.stride = sizeof(obj); +* arr.alignment = alignof(obj); // optional +* arr.bkt = bkt; // optional +* pk_arr_reserve(&arr, 10); // optional +* pk_arr_append(&arr, &obj); +* ``` +* *******************************************************************************/ #define PK_VERSION "@@PK_VERSION@@" @@ -136,4 +157,7 @@ # ifndef PK_IMPL_EV # define PK_IMPL_EV # endif +# ifndef PK_IMPL_ARR +# define PK_IMPL_ARR +# endif #endif |
