VecAllocator
Description
Allocator backing the vector’s storage.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in | Vector to query. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Init.h:85:
.length = VecLen(&(v)), \
.pos = 0, \
.alignment = VecAllocator(&(v)) ? AllocatorAlignment(VecAllocator(&(v))) : 1, \
.dir = 1}- In
Init.h:104:
.length = VecLen(&(v)), \
.pos = 0, \
.alignment = VecAllocator(&(v)) ? AllocatorAlignment(VecAllocator(&(v))) : 1, \
.dir = -1}- In
Init.h:183:
.length = VecLen(&(v)), \
.pos = 0, \
.alignment = VecAllocator(&(v)) ? AllocatorAlignment(VecAllocator(&(v))) : 1, \
.dir = 1})- In
Init.h:203:
.length = VecLen(&(v)), \
.pos = 0, \
.alignment = VecAllocator(&(v)) ? AllocatorAlignment(VecAllocator(&(v))) : 1, \
.dir = -1})- In
Insert.h:533:
.copy_deinit = VecCopyDeinit(vs), \
.data = NULL, \
.allocator = VecAllocator(vs), \
.__magic = VEC_MAGIC | MAGIC_VALIDATED_BIT}, \
clone_vec(GENERIC_VEC(vd), GENERIC_VEC(vs), sizeof(VEC_DATATYPE(vd))))- In
Access.h:46:
/// TAGS: Str, Access, Allocator
///
#define StrAllocator(str) VecAllocator(str)
///
- In
DwarfInfo.c:681:
if (!self)
return;
if (VecAllocator(&self->entries))
VecDeinit(&self->entries);
if (StrAllocator(&self->string_pool))- In
Init.c:65:
// Check initial state
bool result =
(VecLen(&vec) == 0 && VecCapacity(&vec) == 0 && VecBegin(&vec) == NULL && VecAllocator(&vec)->alignment == 1 &&
VecCopyInit(&vec) == NULL && VecCopyDeinit(&vec) == NULL);- In
Init.c:77:
// Check initial state
result = result && (VecLen(&test_vec) == 0 && VecCapacity(&test_vec) == 0 && VecBegin(&test_vec) == NULL &&
VecAllocator(&test_vec)->alignment == 1 && VecCopyInit(&test_vec) == NULL &&
VecCopyDeinit(&test_vec) == NULL);- In
Init.c:99:
// Check initial state
bool result =
(VecLen(&vec) == 0 && VecCapacity(&vec) == 0 && VecBegin(&vec) == NULL && VecAllocator(&vec)->alignment == 4 &&
VecCopyInit(&vec) == NULL && VecCopyDeinit(&vec) == NULL);- In
Init.c:111:
// Check initial state
result = result && (VecLen(&test_vec) == 0 && VecCapacity(&test_vec) == 0 && VecBegin(&test_vec) == NULL &&
VecAllocator(&test_vec)->alignment == 16 && VecCopyInit(&test_vec) == NULL &&
VecCopyDeinit(&test_vec) == NULL);- In
Init.c:132:
// Check initial state
bool result =
(VecLen(&vec) == 0 && VecCapacity(&vec) == 0 && VecBegin(&vec) == NULL && VecAllocator(&vec)->alignment == 1 &&
VecCopyInit(&vec) == (GenericCopyInit)TestItemCopyInit &&
VecCopyDeinit(&vec) == (GenericCopyDeinit)TestItemDeinit);- In
Init.c:154:
// Check initial state
bool result =
(VecLen(&vec) == 0 && VecCapacity(&vec) == 0 && VecBegin(&vec) == NULL && VecAllocator(&vec)->alignment == 8 &&
VecCopyInit(&vec) == (GenericCopyInit)TestItemCopyInit &&
VecCopyDeinit(&vec) == (GenericCopyDeinit)TestItemDeinit);- In
Init.c:195:
TestVec vec_h = VecInitWithDeepCopyT(vec_h, TestItemCopyInit, TestItemDeinit, &h64);
bool result = (VecAllocator(&vec_a)->retry_limit == 17) && (VecAllocator(&vec_b)->retry_limit == 17);
result = result && (VecAllocator(&vec_c)->retry_limit == 17) && (VecAllocator(&vec_d)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->retry_limit == 17) && (VecAllocator(&vec_f)->retry_limit == 17);- In
Init.c:196:
bool result = (VecAllocator(&vec_a)->retry_limit == 17) && (VecAllocator(&vec_b)->retry_limit == 17);
result = result && (VecAllocator(&vec_c)->retry_limit == 17) && (VecAllocator(&vec_d)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->retry_limit == 17) && (VecAllocator(&vec_f)->retry_limit == 17);
result = result && (VecAllocator(&vec_g)->retry_limit == 17) && (VecAllocator(&vec_h)->retry_limit == 17);- In
Init.c:197:
bool result = (VecAllocator(&vec_a)->retry_limit == 17) && (VecAllocator(&vec_b)->retry_limit == 17);
result = result && (VecAllocator(&vec_c)->retry_limit == 17) && (VecAllocator(&vec_d)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->retry_limit == 17) && (VecAllocator(&vec_f)->retry_limit == 17);
result = result && (VecAllocator(&vec_g)->retry_limit == 17) && (VecAllocator(&vec_h)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->alignment == 8) && (VecAllocator(&vec_f)->alignment == 16);- In
Init.c:198:
result = result && (VecAllocator(&vec_c)->retry_limit == 17) && (VecAllocator(&vec_d)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->retry_limit == 17) && (VecAllocator(&vec_f)->retry_limit == 17);
result = result && (VecAllocator(&vec_g)->retry_limit == 17) && (VecAllocator(&vec_h)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->alignment == 8) && (VecAllocator(&vec_f)->alignment == 16);
result = result && (VecAllocator(&vec_g)->alignment == 32) && (VecAllocator(&vec_h)->alignment == 64);- In
Init.c:199:
result = result && (VecAllocator(&vec_e)->retry_limit == 17) && (VecAllocator(&vec_f)->retry_limit == 17);
result = result && (VecAllocator(&vec_g)->retry_limit == 17) && (VecAllocator(&vec_h)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->alignment == 8) && (VecAllocator(&vec_f)->alignment == 16);
result = result && (VecAllocator(&vec_g)->alignment == 32) && (VecAllocator(&vec_h)->alignment == 64);
result = result && (VecCopyInit(&vec_c) == (GenericCopyInit)TestItemCopyInit);- In
Init.c:200:
result = result && (VecAllocator(&vec_g)->retry_limit == 17) && (VecAllocator(&vec_h)->retry_limit == 17);
result = result && (VecAllocator(&vec_e)->alignment == 8) && (VecAllocator(&vec_f)->alignment == 16);
result = result && (VecAllocator(&vec_g)->alignment == 32) && (VecAllocator(&vec_h)->alignment == 64);
result = result && (VecCopyInit(&vec_c) == (GenericCopyInit)TestItemCopyInit);
result = result && (VecCopyDeinit(&vec_d) == (GenericCopyDeinit)TestItemDeinit);- In
Init.c:231:
VecInitStack(int, vec, 10) {
// Stack-init: NULL allocator distinguishes from heap-init.
if (VecLen(&vec) != 0 || VecCapacity(&vec) != 10 || VecBegin(&vec) == NULL || VecAllocator(&vec) != NULL) {
result = false;
}- In
Init.c:247:
VecInitStack(TestItem, test_vec, 5) {
if (VecLen(&test_vec) != 0 || VecCapacity(&test_vec) != 5 || VecBegin(&test_vec) == NULL ||
VecAllocator(&test_vec) != NULL) {
result = false;
}- In
Init.c:314:
bool result =
(VecLen(&clone) == VecLen(&src) && VecCapacity(&clone) >= VecLen(&src) && VecBegin(&clone) != VecBegin(&src) &&
VecAllocator(&clone)->alignment == VecAllocator(&src)->alignment);
// Check the actual data
- In
Insert.c:388:
// int[]. Stronger alignment is exercised separately - it's not what
// this test is asserting.
IntVec dst = VecInit(VecAllocator(&src));
// intentional bypass: testing hook propagation; no public VecSetCopyHooks mutator exists
dst.copy_init = src.copy_init;- In
Insert.c:394:
bool cloned = VecPushBackArrR(&dst, VecBegin(&src), VecLen(&src));
bool allocator_matches = VecAllocator(&dst) == VecAllocator(&src);
bool result = cloned && VecCopyInit(&dst) == VecCopyInit(&src) && VecCopyDeinit(&dst) == VecCopyDeinit(&src) &&- In
Insert.c:397:
bool result = cloned && VecCopyInit(&dst) == VecCopyInit(&src) && VecCopyDeinit(&dst) == VecCopyDeinit(&src) &&
VecAllocator(&dst)->effort == ALLOCATOR_EFFORT_RETRY_FALLBACK &&
VecAllocator(&dst)->retry_limit == 11 && allocator_matches && VecLen(&src) == 3 &&
VecAt(&src, 0) == 10 && VecAt(&src, 1) == 20 && VecAt(&src, 2) == 30 && VecLen(&dst) == 3 &&- In
Insert.c:398:
bool result = cloned && VecCopyInit(&dst) == VecCopyInit(&src) && VecCopyDeinit(&dst) == VecCopyDeinit(&src) &&
VecAllocator(&dst)->effort == ALLOCATOR_EFFORT_RETRY_FALLBACK &&
VecAllocator(&dst)->retry_limit == 11 && allocator_matches && VecLen(&src) == 3 &&
VecAt(&src, 0) == 10 && VecAt(&src, 1) == 20 && VecAt(&src, 2) == 30 && VecLen(&dst) == 3 &&
VecAt(&dst, 0) == 10 && VecAt(&dst, 1) == 20 && VecAt(&dst, 2) == 30;- In
Type.c:31:
// Check initial state
bool result =
(VecLen(&vec) == 0 && VecCapacity(&vec) == 0 && VecBegin(&vec) == NULL && VecAllocator(&vec)->alignment == 1 &&
VecCopyInit(&vec) == NULL && VecCopyDeinit(&vec) == NULL);- In
Type.c:43:
// Check initial state
result = result && (VecLen(&test_vec) == 0 && VecCapacity(&test_vec) == 0 && VecBegin(&test_vec) == NULL &&
VecAllocator(&test_vec)->alignment == 1 && VecCopyInit(&test_vec) == NULL &&
VecCopyDeinit(&test_vec) == NULL);
Last updated on