Vec
Description
Typesafe vector definition. This is much like C++ template std::vector
Using this directly like Vec(T) won’t always work, because each time this is used it defines a new type, and two Vec(T)s are different from each other.
To deal with this, you must typedef vector for a specific type. Throughout the code, any time that is in plural form is generally a vector. Like Strs is a typedef of Vec(Str).
Fields
| Name | Description |
|---|---|
length |
Number of items currently in vector (always <= capacity) |
capacity |
Max number of items this vector can hold before doing a resize. |
copy_init |
If provided then is used to create owned copies of items into vector. |
copy_deinit |
If provided then is used to deinit data held by vector. Caution when dealing with shared ownership. |
data |
Data held by vector. Don’t access by direct indexing. Use VecAt(..) |
allocator |
Allocator bound to this vector. Its alignment field governs both the alignment of the underlying buffer and the per-element stride. NULL for stack-init vecs (VecInitStack / StrInitStack): the macro plants an _Alignas(T) char[] backing buffer so per-element stride collapses to sizeof(T), and any operation that would grow the vec aborts via VecReserve. |
Usage example (from documentation)
Vec(int) integers; // Vector of integers
Vec(CustomStruct) my_data; // Vector of CustomStruct
Vec(float) real_numbers; // Vector of float values
Vec(Zstr) names; Vector of c-style null-terminated stringsUsage example (Cross-references)
Usage examples (Cross-references)
- In
Vec.c:8:
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Std/Memory.h>- In
Str.c:10:
#include <Misra/Std/Container/Str/Private.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Container/Vec/Private.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Dwarf.c:19:
// Each `Vec(u64)` use is its own anonymous struct type, so a typedef
// is required to pass these around between functions.
typedef Vec(u64) U64Vec;
// ---------------------------------------------------------------------------
- In
DwarfInfo.c:86:
} AbbrevAttr;
typedef Vec(AbbrevAttr) AbbrevAttrVec;
typedef struct AbbrevEntry {- In
DwarfInfo.c:95:
} AbbrevEntry;
typedef Vec(AbbrevEntry) AbbrevTable;
static void abbrev_table_deinit(AbbrevTable *t) {- In
DwarfInfo.c:333:
} PendingFn;
typedef Vec(PendingFn) PendingFns;
static bool walk_cu_dies(- In
Pdb.c:519:
} PendingPub;
typedef Vec(PendingPub) PendingPubs;
static i32 cmp_pending(const void *lhs, const void *rhs) {- In
VecCharPtr.c:9:
#include "../Harness.h"
#include "VecCharPtr.h"
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Std/Zstr.h>- In
VecCharPtr.h:10:
#define FUZZ_VEC_CHAR_PTR_H
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Types.h>- In
VecCharPtr.h:15:
// Vec(char*) typedef
typedef Vec(char *) CharPtrVec;
// Vec(char*) function enumeration
- In
VecInt.h:10:
#define FUZZ_VEC_INT_H
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Types.h>- In
VecInt.h:15:
// Vec(i32) typedef
typedef Vec(i32) IntVec;
// Vec(i32) function enumeration
- In
VecStr.h:10:
#define FUZZ_VEC_STR_H
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Allocator/Default.h>- In
VecStr.h:16:
// Vec(Str) typedef
typedef Vec(Str) StrVec;
// Vec(Str) function enumeration
- In
VecStr.c:9:
#include "../Harness.h"
#include "VecStr.h"
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Log.h>- In
VecInt.c:9:
#include "../Harness.h"
#include "VecInt.h"
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h> f64 small_float;
bool is_valid;
Vec(Str) empty_array;
Vec(i64) numbers;
} EdgeCaseData; bool is_valid;
Vec(Str) empty_array;
Vec(i64) numbers;
} EdgeCaseData; StrIter si1 = StrIterFromStr(json1);
Vec(i32) items = VecInit(&alloc);
JR_OBJ(si1, { StrIter si2 = StrIterFromStr(json2);
Vec(Str) data = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
JR_OBJ(si2, { struct {
i32 x_value;
Vec(i32) filled_items;
} obj = {0, VecInit(&alloc)}; } AnnSymbol;
typedef Vec(AnnSymbol) AnnSymbols;
typedef struct ApiResponse { u64 analysis_id;
Str sha256;
Vec(Str) tags;
Str created_at;
u64 model_id; Str json = StrInit(&alloc);
Vec(FunctionInfo) functions = VecInitWithDeepCopy(NULL, FunctionInfoDeinit, &alloc);
FunctionInfo func1 = {12345, StrInitFromZstr("test_func", &alloc), 1024, 4096}; Str json = StrInit(&alloc);
Vec(AnnSymbol) symbols = VecInitWithDeepCopy(NULL, AnnSymbolDeinit, &alloc);
AnnSymbol sym1 = {0}; Str json = StrInit(&alloc);
Vec(u32) numbers = VecInit(&alloc);
u32 num1 = 1, num2 = 2, num3 = 3;
VecPushBack(&numbers, num1); VecPushBack(&numbers, num3);
Vec(Str) strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
// Create strings and push them properly
VecPushBack(&strings, str3);
Vec(bool) booleans = VecInit(&alloc);
bool bool1 = true, bool2 = false, bool3 = true;
VecPushBack(&booleans, bool1); Str name;
f64 price;
Vec(Str) tags;
} SimpleProduct; Str json = StrInit(&alloc);
Vec(Str) languages = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
// Create strings and push them properly
Str json = StrInit(&alloc);
Vec(i32) empty_numbers = VecInit(&alloc);
Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
Vec(i32) empty_numbers = VecInit(&alloc);
Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
JW_OBJ(json, { Str json = StrInit(&alloc);
Vec(i32) empty_list = VecInit(&alloc);
JW_OBJ(json, { Str json = StrInit(&alloc);
Vec(i32) empty_arr = VecInit(&alloc);
Vec(i32) filled_arr = VecInit(&alloc);
i32 val1 = 1, val2 = 2;
Vec(i32) empty_arr = VecInit(&alloc);
Vec(i32) filled_arr = VecInit(&alloc);
i32 val1 = 1, val2 = 2;
VecPushBack(&filled_arr, val1);- In
Read.Nested.c:28:
} AnnSymbol;
typedef Vec(AnnSymbol) AnnSymbols;
typedef struct ApiResponse {- In
Read.Nested.c:51:
} FunctionInfo;
typedef Vec(FunctionInfo) FunctionInfos;
typedef struct ModelInfo {- In
Read.Nested.c:58:
} ModelInfo;
typedef Vec(ModelInfo) ModelInfos;
typedef struct SearchResult {- In
Read.Nested.c:65:
u64 analysis_id;
Str sha256;
Vec(Str) tags;
Str created_at;
u64 model_id;- In
Read.Nested.c:72:
} SearchResult;
typedef Vec(SearchResult) SearchResults;
void FunctionInfoDeinit(FunctionInfo *info) { StrIter si = StrIterFromStr(json);
typedef Vec(AnnSymbol) Symbols;
Symbols symbols = VecInitWithDeepCopy(NULL, AnnSymbolDeinit, &alloc);- In
Read.Simple.c:33:
Str name;
f64 price;
Vec(Str) tags;
} SimpleProduct; StrIter si = StrIterFromStr(json);
Vec(Str) languages = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
JR_OBJ(si, {- In
RoundTrip.c:28:
u32 timeout;
Str log_level;
Vec(Str) features;
} TestConfig;- In
RoundTrip.c:34:
TestPerson user;
TestConfig config;
Vec(i32) numbers;
Vec(bool) flags;
} ComplexData;- In
RoundTrip.c:35:
TestConfig config;
Vec(i32) numbers;
Vec(bool) flags;
} ComplexData;- In
RoundTrip.c:370:
// Original data
Vec(i32) original_numbers = VecInit(&alloc);
Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);- In
RoundTrip.c:371:
// Original data
Vec(i32) original_numbers = VecInit(&alloc);
Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
// Populate arrays
- In
RoundTrip.c:398:
// Read back from JSON
Vec(i32) parsed_numbers = VecInit(&alloc);
Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);- In
RoundTrip.c:399:
// Read back from JSON
Vec(i32) parsed_numbers = VecInit(&alloc);
Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
StrIter si = StrIterFromStr(json);- In
RoundTrip.c:675:
// Original empty data
Vec(i32) empty_numbers = VecInit(&alloc);
Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
Str empty_str = StrInit(&alloc);- In
RoundTrip.c:676:
// Original empty data
Vec(i32) empty_numbers = VecInit(&alloc);
Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
Str empty_str = StrInit(&alloc);- In
RoundTrip.c:695:
// Read back from JSON
Vec(i32) parsed_numbers = VecInit(&alloc);
Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
Str parsed_str = StrInit(&alloc);- In
RoundTrip.c:696:
// Read back from JSON
Vec(i32) parsed_numbers = VecInit(&alloc);
Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
Str parsed_str = StrInit(&alloc);
bool found_empty_object = false; #include <Misra/Std/Allocator.h>
#include <Misra/Std/Allocator/Page.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Io.h>
#include <Misra/Std/Log.h> // Exercises the internal descriptor table across multiple grows.
PageAllocator alloc = PageAllocatorInit();
typedef Vec(int) IntVec;
IntVec v = VecInit(&alloc);
bool ok = true;- In
Vec.Ops.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h> // For LVAL macro- In
Vec.Ops.c:35:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Ops.c:70:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Ops.c:122:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Ops.c:159:
int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Ops tests\n\n");
// Array of test functions
- In
Vec.Ops.c:167:
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Ops");
DefaultAllocatorDeinit(&alloc);
return rc;- In
Vec.Foreach.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Vec.Foreach.c:35:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Foreach.c:74:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing VecForeach where modification causes out of bounds access (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing VecForeachIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing VecForeachReverseIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing VecForeachPtrIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing VecForeachPtrReverseIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing VecForeachPtrInRangeIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); WriteFmt("Testing basic VecForeachIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc); int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Foreach.Simple tests\n\n");
// Array of normal test functions
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Foreach.Simple");
DefaultAllocatorDeinit(&alloc);
return rc; Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecFindAllPattern Vec form\n");
BitVec source = BitVecInit(base); #include <Misra/Std/Allocator.h>
#include <Misra/Std/Allocator/Arena.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Io.h>
#include <Misra/Std/Log.h> static bool test_vec_on_arena(void) {
ArenaAllocator arena = ArenaAllocatorInit();
typedef Vec(int) IntVec;
IntVec v = VecInit(&arena);
bool ok = true;- In
Vec.Init.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Vec.Init.c:48:
// Test with int type
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Init.c:59:
// Test with struct type
typedef Vec(TestItem) TestVec;
TestVec test_vec = VecInit(&alloc);- In
Vec.Init.c:82:
// Test with int type and 4-byte alignment
typedef Vec(int) IntVec;
IntVec vec = VecInit(&aligned4);- In
Vec.Init.c:93:
// Test with struct type and 16-byte alignment
typedef Vec(TestItem) TestVec;
TestVec test_vec = VecInit(&aligned16);- In
Vec.Init.c:115:
// Test with struct type and custom copy/deinit functions
typedef Vec(TestItem) TestVec;
TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit, &alloc);- In
Vec.Init.c:137:
// Test with struct type, custom copy/deinit functions, and 8-byte alignment
typedef Vec(TestItem) TestVec;
TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit, &aligned8);- In
Vec.Init.c:157:
WriteFmt("Testing VecInit optional allocator\n");
typedef Vec(TestItem) TestVec;
// Build several heaps with distinct configuration; the test verifies
- In
Vec.Init.c:286:
// Create a source vector
typedef Vec(int) IntVec;
IntVec src = VecInit(&alloc);- In
Vec.Init.c:324:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Init tests\n\n");
alloc = DefaultAllocatorInit();- In
Vec.Init.c:342:
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Init");
DefaultAllocatorDeinit(&alloc);
return rc;- In
Vec.Memory.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Vec.Memory.c:22:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Memory.c:62:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Memory.c:110:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Memory.c:157:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Memory.c:193:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Memory tests\n\n");
// Array of test functions
- In
Vec.Memory.c:201:
// Run all tests using the centralized test driver
return run_test_suite(tests, total_tests, NULL, 0, "Vec.Memory");
}- In
Vec.Remove.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Vec.Remove.c:34:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:82:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:130:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:178:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:215:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:251:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:327:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:373:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:409:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:444:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:525:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:602:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:639:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:674:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:753:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Remove.c:849:
alloc = DefaultAllocatorInit();
int rc = run_test_suite(normal_tests, normal_count, NULL, 0, "Vec.Remove");
DefaultAllocatorDeinit(&alloc);
return rc; Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecRunLengths Vec form\n");
BitVec bv = BitVecInit(base);- In
Vec.Complex.c:4:
#include <Misra/Std/Allocator/Heap.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Memory.h>
#include <Misra/Std/Log.h>
// Create a vector of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
// Create a vector of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
// Create a vector of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
// Create two vectors of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec1 = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
ComplexVec vec2 = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
// Create a temporary vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec temp_vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec1 = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
ComplexVec vec2 = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc); int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Complex tests\n\n");
// Array of test functions
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Complex");
DefaultAllocatorDeinit(&alloc);
return rc;- In
Vec.Access.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Vec.Access.c:31:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:66:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:106:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:140:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:174:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:199:
// Test with a vector with alignment > 1
typedef Vec(int) AlignedIntVec;
AlignedIntVec aligned_vec = VecInit(&aligned8);- In
Vec.Access.c:229:
// Create a vector of integers with default alignment (1)
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:241:
// Create a vector with 8-byte alignment
typedef Vec(int) AlignedIntVec;
AlignedIntVec aligned_vec = VecInit(&aligned8);- In
Vec.Access.c:266:
DefaultAllocator alloc = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Access.c:293:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Access tests\n\n");
// Array of test functions
- In
Vec.Access.c:309:
// Run all tests using the centralized test driver
return run_test_suite(tests, total_tests, NULL, 0, "Vec.Access");
}- In
Vec.Type.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Vec.Type.c:21:
// Test basic Vec type functionality
bool test_vec_type_basic(void) {
WriteFmt("Testing basic Vec type functionality\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Vec.Type.c:26:
// Define a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Type.c:38:
// Test with a struct type
typedef Vec(TestItem) TestVec;
TestVec test_vec = VecInit(&alloc);- In
Vec.Type.c:61:
// Create a valid vector
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Type.c:79:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Type tests\n\n");
// Array of test functions
- In
Vec.Type.c:87:
// Run all tests using the centralized test driver
return run_test_suite(tests, total_tests, NULL, 0, "Vec.Type");
}- In
Vec.Insert.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h> // For LVAL macro- In
Vec.Insert.c:30:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:58:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:86:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:121:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:162:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:203:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:236:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:274:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec1 = VecInit(&alloc);- In
Vec.Insert.c:317:
WriteFmt("Testing manual clone allocator inheritance\n");
typedef Vec(int) IntVec;
HeapAllocator local_heap = HeapAllocatorInit();- In
Vec.Insert.c:360:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:443:
// Create a vector of integers without copy_init
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:523:
WriteFmt("Testing VecInsertRangeFast with count > (length - idx)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Vec.Insert.c:570:
int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Insert tests\n\n");
// Array of test functions
- In
Vec.Insert.c:591:
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Insert");
DefaultAllocatorDeinit(&alloc);
return rc;- In
Zstr.h:13:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Vec/Type.h>
#include <Misra/Types.h>- In
Zstr.h:35:
/// canonical Cstr / Zstr / unsuffixed-Str overload family.
typedef const char *Zstr;
typedef Vec(Zstr) Zstrs;
///
- In
Container.h:16:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#if FEATURE_BITVEC- In
ArgParse.h:43:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
ArgParse.h:123:
} ArgSpec;
typedef Vec(ArgSpec) ArgSpecs;
///
- In
StrIter.h:14:
#define MISRA_STD_UTILITY_STR_ITER_H
#include <Misra/Std/Container/Vec/Type.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Utility/Iter.h>- In
StrIter.h:20:
typedef Iter(char) StrIter;
typedef Vec(StrIter) StrIters;
///
- In
Debug.h:60:
#include <Misra/Std/Container/Map.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Sys/Backtrace.h>- In
Debug.h:102:
} DebugFreedEntry;
typedef Vec(DebugFreedEntry) DebugFreedVec;
///
- In
Buf.h:13:
#define MISRA_STD_CONTAINER_BUF_H
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Memory.h>
#include <Misra/Std/Utility/Iter.h>- In
Buf.h:19:
#include <Misra/Types.h>
typedef Vec(u8) Buf;
/// Iterator over an immutable byte buffer. Layout matches `Iter(const u8)`
- In
Vec.h:11:
// clang-format off
#include "Vec/Type.h"
#include "Vec/Init.h"
#include "Vec/Insert.h"- In
Vec.h:12:
// clang-format off
#include "Vec/Type.h"
#include "Vec/Init.h"
#include "Vec/Insert.h"
#include "Vec/Remove.h"- In
Vec.h:13:
#include "Vec/Type.h"
#include "Vec/Init.h"
#include "Vec/Insert.h"
#include "Vec/Remove.h"
#include "Vec/Access.h"- In
Vec.h:14:
#include "Vec/Init.h"
#include "Vec/Insert.h"
#include "Vec/Remove.h"
#include "Vec/Access.h"
#include "Vec/Memory.h"- In
Vec.h:15:
#include "Vec/Insert.h"
#include "Vec/Remove.h"
#include "Vec/Access.h"
#include "Vec/Memory.h"
#include "Vec/Foreach.h"- In
Vec.h:16:
#include "Vec/Remove.h"
#include "Vec/Access.h"
#include "Vec/Memory.h"
#include "Vec/Foreach.h"
#include "Vec/Ops.h"- In
Vec.h:17:
#include "Vec/Access.h"
#include "Vec/Memory.h"
#include "Vec/Foreach.h"
#include "Vec/Ops.h"
#include "Vec/Private.h"- In
Vec.h:18:
#include "Vec/Memory.h"
#include "Vec/Foreach.h"
#include "Vec/Ops.h"
#include "Vec/Private.h"
// clang-format on
- In
Vec.h:19:
#include "Vec/Foreach.h"
#include "Vec/Ops.h"
#include "Vec/Private.h"
// clang-format on
- In
Type.h:10:
#define MISRA_STD_CONTAINER_GRAPH_TYPE_H
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
Type.h:76:
/// TAGS: Graph, Edge, Neighbor, Vec
///
typedef Vec(GraphNodeId) GraphNeighbors;
///
- In
Type.h:94:
} GenericGraphSlot;
typedef Vec(GenericGraphSlot) GraphSlots;
typedef Vec(u32) GraphFreeIndices;- In
Type.h:95:
typedef Vec(GenericGraphSlot) GraphSlots;
typedef Vec(u32) GraphFreeIndices;
///
- In
Type.h:120:
} GraphPendingEdgeRemoval;
typedef Vec(GraphPendingEdgeRemoval) GraphPendingEdgeRemovals;
typedef struct {- In
Type.h:175:
#define Graph(T) \
struct { \
Vec(GraphSlot(T)) slots; \
GraphFreeIndices free_indices; \
GraphPendingEdgeRemovals pending_edge_removals; \- In
Init.h:155:
UNPL(_s).done == 0; \
MemSet(UNPL(_s).d, 0, sizeof(UNPL(_s).d)), UNPL(_s).done = 1) \
for (Vec(T) name = {.length = 0, \
.capacity = (ne), \
.copy_init = NULL, \
- In
Type.h:12:
#include <Misra/Std/Container/Common.h>
#include <Misra/Types.h>
#include <Misra/Std/Container/Vec.h>
///
- In
Type.h:41:
} BitVec;
typedef Vec(BitVec) BitVecs;
///
- In
Type.h:49:
/// TAGS: BitVec, Type, Match
///
typedef Vec(size) BitVecMatchIndices;
///
- In
Type.h:68:
/// TAGS: BitVec, Type, Run
///
typedef Vec(BitVecRun) BitVecRuns;
#define BITVEC_MAGIC MAKE_NEW_MAGIC_VALUE("bitvectr")- In
Init.h:14:
#include <Misra/Std/Memory.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Container/Vec/Type.h>
#ifdef __cplusplus- In
Access.h:11:
#include "Type.h"
#include <Misra/Std/Container/Vec/Access.h>
#ifdef __cplusplus- In
Insert.h:11:
#include "Type.h"
#include <Misra/Std/Container/Vec/Insert.h>
#include <Misra/Std/Zstr.h>- In
Type.h:10:
#define MISRA_STD_CONTAINER_STR_TYPE_H
#include <Misra/Std/Container/Vec/Type.h>
#include <Misra/Std/Utility/Iter/Type.h>
#include <Misra/Types.h>- In
Type.h:19:
/// TAGS: Str, Type, API
///
typedef Vec(char) Str;
///
- In
Type.h:26:
/// TAGS: Str, Type, Vector
///
typedef Vec(Str) Strs;
///
- In
ProcMaps.h:22:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
ProcMaps.h:45:
} ProcMapEntry;
typedef Vec(ProcMapEntry) ProcMapEntries;
typedef struct ProcMaps {- In
Backtrace.h:46:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
Backtrace.h:76:
/// TAGS: Backtrace, Type, Frame
///
typedef Vec(StackFrame) StackFrames;
// ---------------------------------------------------------------------------
- In
MachoCache.h:28:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str/Type.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
MachoCache.h:43:
} MachoCacheEntry;
typedef Vec(MachoCacheEntry) MachoCacheEntries;
typedef struct MachoCache {- In
Dir.h:16:
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>- In
Dir.h:88:
/// Vector type for directory contents.
///
typedef Vec(DirEntry) DirContents;
// Path-arg dispatch. Library design: `Str *` is the canonical path
- In
Dns.h:31:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Sys/Socket.h>
#include <Misra/Types.h>- In
Dns.h:52:
} HostsEntry;
typedef Vec(HostsEntry) HostsTable;
typedef Vec(SocketAddr) DnsAddrs;- In
Dns.h:53:
typedef Vec(HostsEntry) HostsTable;
typedef Vec(SocketAddr) DnsAddrs;
///
#endif
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Sys/ProcMaps.h>
#include <Misra/Types.h> } ResolverCacheEntry;
typedef Vec(ResolverCacheEntry) ResolverCache;
typedef struct SymbolResolver {- In
PdbCache.h:30:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str/Type.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
PdbCache.h:42:
} PdbCacheEntry;
typedef Vec(PdbCacheEntry) PdbCacheEntries;
typedef struct PdbCache {- In
Pe.h:25:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
Pe.h:52:
} PeSection;
typedef Vec(PeSection) PeSections;
///
- In
Pdb.h:32:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
Pdb.h:54:
} PdbFunction;
typedef Vec(PdbFunction) PdbFunctions;
///
- In
Dwarf.h:28:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
Dwarf.h:58:
} DwarfLineEntry;
typedef Vec(DwarfLineEntry) DwarfLineEntries;
///
- In
Dwarf.h:169:
} DwarfFde;
typedef Vec(DwarfCie) DwarfCies;
typedef Vec(DwarfFde) DwarfFdes;- In
Dwarf.h:170:
typedef Vec(DwarfCie) DwarfCies;
typedef Vec(DwarfFde) DwarfFdes;
///
- In
Dwarf.h:326:
} DwarfFunction;
typedef Vec(DwarfFunction) DwarfFunctionEntries;
///
- In
Http.h:58:
#define HttpHeaderInit_1(alloc_ptr) ((HttpHeader) {.key = StrInit_1(alloc_ptr), .value = StrInit_1(alloc_ptr)})
typedef Vec(HttpHeader) HttpHeaders;
///
- In
Elf.h:23:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
Elf.h:133:
} ElfSymbol;
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;- In
Elf.h:134:
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;
///
- In
MachO.h:29:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Types.h>- In
MachO.h:80:
} MachoSymbol;
typedef Vec(MachoSegment) MachoSegments;
typedef Vec(MachoSection) MachoSections;
typedef Vec(MachoSymbol) MachoSymbols;- In
MachO.h:81:
typedef Vec(MachoSegment) MachoSegments;
typedef Vec(MachoSection) MachoSections;
typedef Vec(MachoSymbol) MachoSymbols;- In
MachO.h:82:
typedef Vec(MachoSegment) MachoSegments;
typedef Vec(MachoSection) MachoSections;
typedef Vec(MachoSymbol) MachoSymbols;
///
- In
Dns.h:26:
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Types.h>- In
Dns.h:81:
} DnsRecord;
typedef Vec(DnsRecord) DnsRecords;
///
Last updated on