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 the alignment of the underlying buffer base only; the per-element stride is always sizeof(T). NULL for stack-init vecs (VecInitStack / StrInitStack): the macro plants an _Alignas(T) char[] backing buffer, 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
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
ArgParse.h:43:
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/File.h>
#include <Misra/Std/Zstr.h>- In
ArgParse.h:124:
} ArgSpec;
typedef Vec(ArgSpec) ArgSpecs;
///
- 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
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
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
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
Init.h:14:
#include <Misra/Std/Memory.h>
#include <Misra/Std/Zstr.h>
#include <Misra/Std/Container/Vec/Type.h>
#ifdef __cplusplus- In
Insert.h:11:
#include "Type.h"
#include <Misra/Std/Container/Vec/Insert.h>
#include <Misra/Std/Zstr.h>- In
Access.h:11:
#include "Type.h"
#include <Misra/Std/Container/Vec/Access.h>
#ifdef __cplusplus- 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
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
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
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:41:
} PdbCacheEntry;
typedef Vec(PdbCacheEntry) PdbCacheEntries;
typedef struct PdbCache { #endif
#include <Misra/Std/Allocator.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Parsers/ProcMaps.h>
#include <Misra/Types.h> } ResolverCacheEntry;
typedef Vec(ResolverCacheEntry) ResolverCache;
typedef struct SymbolResolver {- 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;
///
- 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
Http.h:58:
#define HttpHeaderInit_1(alloc_ptr) ((HttpHeader) {.key = StrInit_1(alloc_ptr), .value = StrInit_1(alloc_ptr)})
typedef Vec(HttpHeader) HttpHeaders;
///
- 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
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:175:
} ElfSegment;
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;
typedef Vec(ElfSegment) ElfSegments;- In
Elf.h:176:
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;
typedef Vec(ElfSegment) ElfSegments;- In
Elf.h:177:
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;
typedef Vec(ElfSegment) ElfSegments;
///
- 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
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;
///
- In
ProcMaps.h:23:
#include <Misra/Std/Container/Buf.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/File.h>
#include <Misra/Types.h>- In
ProcMaps.h:47:
} ProcMapEntry;
typedef Vec(ProcMapEntry) ProcMapEntries;
typedef struct ProcMaps {- 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
VecInt.c:9:
#include "../Harness.h"
#include "VecInt.h"
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- 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
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
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
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
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
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
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
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
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
Ops.c:41:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Ops.c:76:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Ops.c:128:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Ops.c:168:
WriteFmt("Testing swap rejects idx == length\n");
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&alloc);
for (u32 i = 0; i < 3; i++) {- In
Ops.c:193:
WriteFmt("Testing swap rejects idx1 == length (476:14)\n");
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&alloc);
for (u32 i = 0; i < 3; i++) {- In
Ops.c:209:
int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Ops tests\n\n");
// Array of test functions
- In
Ops.c:220:
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, deadend_tests, deadend_count, "Vec.Ops");
DefaultAllocatorDeinit(&alloc);
return rc;- In
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>- In
Complex.c:182:
// Create a vector of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);- In
Complex.c:225:
// Create a vector of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);- In
Complex.c:269:
// Create a vector of ComplexItem with deep copy functions
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);- In
Complex.c:312:
// 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);- In
Complex.c:390:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Complex.c:438:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Complex.c:515:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Complex.c:606:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Complex.c:672:
// 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);- In
Complex.c:698:
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);- In
Complex.c:730:
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);- In
Complex.c:799:
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);- In
Complex.c:826:
// 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);- In
Complex.c:864:
// Create a vector with no copy_init but with copy_deinit for proper cleanup
typedef Vec(ComplexItem) ComplexVec;
ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);- In
Complex.c:906:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec src = VecInit(&local);
int values[] = {1, 2, 3};- In
Complex.c:932:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec src = VecInit(&local);
int values[] = {1, 2, 3};- In
Complex.c:958:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec src = VecInit(&local);
int values[] = {1, 2, 3};- In
Complex.c:983:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec src = VecInit(&local);
int values[] = {1, 2, 3};- In
Complex.c:1008:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec src = VecInit(&local);
int values[] = {1, 2, 3};- In
Complex.c:1031:
int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Complex tests\n\n");
// Array of test functions
- In
Complex.c:1060:
// 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
Memory.c:4:
#include <Misra/Std/Allocator/Heap.h>
#include <Misra/Std/Container/Str.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>
#include <Misra/Std/Zstr.h>- In
Memory.c:87:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Memory.c:127:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Memory.c:175:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Memory.c:222:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Memory.c:264:
WriteFmtLn("Testing resize grow enlarges capacity (525:18)");
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&alloc);- In
Memory.c:288:
reset_deinit_state();
typedef Vec(int) IntVec;
IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);- In
Memory.c:309:
WriteFmtLn("Testing resize grow reserves backing capacity (531:14)");
typedef Vec(u64) U64Vec;
U64Vec vec = VecInit(&alloc);- In
Memory.c:331:
WriteFmtLn("Testing resize grow sets exact length (534:21)");
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&alloc);- In
Memory.c:352:
WriteFmtLn("Testing reserve_pow2 rounds to a power of two (145:10)");
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&alloc);- In
Memory.c:377:
HeapAllocator heap = HeapAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&heap);- In
Memory.c:425:
HeapAllocator heap = HeapAllocatorInit(); // alignment 1 -> aligned_size == 1
typedef Vec(char) CharVec;
CharVec vec = VecInit(&heap);- In
Memory.c:486:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(char) CharVec;
CharVec vec = VecInit(&local);- In
Memory.c:514:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);
vec.copy_deinit = (GenericCopyDeinit)clear_counting_deinit;- In
Memory.c:549:
u8 pad[60];
} Wide; // sizeof == 64
typedef Vec(Wide) WideVec;
WideVec vec = VecInit(&local);- In
Memory.c:579:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);- In
Memory.c:604:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);- In
Memory.c:625:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);- In
Memory.c:646:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);- In
Memory.c:676:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);- In
Memory.c:713:
u8 bytes[(size)1 << 21];
} Big;
typedef Vec(Big) BigVec;
BigVec vec = VecInit(&alloc);- In
Memory.c:728:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Memory tests\n\n");
alloc = DefaultAllocatorInit();- In
Memory.c:770:
// Run all tests using the centralized test driver
int rc = run_test_suite(tests, total_tests, deadend_tests, deadend_count, "Vec.Memory");
DefaultAllocatorDeinit(&alloc);
return rc;- In
Init.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Init.c:60:
// Test with int type
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Init.c:72:
// Test with struct type
typedef Vec(TestItem) TestVec;
TestVec test_vec = VecInit(&alloc);- In
Init.c:94:
// Test with int type and 4-byte alignment
typedef Vec(int) IntVec;
IntVec vec = VecInit(&aligned4);- In
Init.c:106:
// Test with struct type and 16-byte alignment
typedef Vec(TestItem) TestVec;
TestVec test_vec = VecInit(&aligned16);- In
Init.c:127:
// Test with struct type and custom copy/deinit functions
typedef Vec(TestItem) TestVec;
TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit, &alloc);- In
Init.c:149:
// Test with struct type, custom copy/deinit functions, and 8-byte alignment
typedef Vec(TestItem) TestVec;
TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit, &aligned8);- In
Init.c:169:
WriteFmt("Testing VecInit optional allocator\n");
typedef Vec(TestItem) TestVec;
// Build several heaps with distinct configuration; the test verifies
- In
Init.c:297:
// Create a source vector
typedef Vec(int) IntVec;
IntVec src = VecInit(&alloc);- In
Init.c:340:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&local);
vec.copy_deinit = (GenericCopyDeinit)counting_deinit;- In
Init.c:360:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Init tests\n\n");
alloc = DefaultAllocatorInit();- In
Init.c:380:
// 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
Insert.c:3:
#include <Misra/Std/Allocator/Debug.h>
#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
Insert.c:83:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:111:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:139:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:174:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:215:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:256:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:289:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:327:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec1 = VecInit(&alloc);- In
Insert.c:370:
WriteFmt("Testing manual clone allocator inheritance\n");
typedef Vec(int) IntVec;
HeapAllocator local_heap = HeapAllocatorInit();- In
Insert.c:413:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:496:
// Create a vector of integers without copy_init
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:576:
WriteFmt("Testing VecInsertRangeFast with count > (length - idx)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:633:
} Elem;
typedef Vec(Elem) ElemVec;
// ---- copy_init / copy_deinit fixture instrumentation --------------------
- In
Insert.c:732:
WriteFmt("Testing fast-insert grows when length+count reaches capacity\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:779:
WriteFmt("Testing fast-insert grows at length+count == capacity boundary\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:808:
WriteFmt("Testing fast-insert grows an empty vector\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:832:
WriteFmt("Testing fast-insert honors reserve growth result\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Insert.c:1397:
}
typedef Vec(TrackItem) TrackVec;
typedef Vec(u64) U64Vec;- In
Insert.c:1398:
typedef Vec(TrackItem) TrackVec;
typedef Vec(u64) U64Vec;
// Build a TrackVec containing items with the given tags (copy_init never
- In
Insert.c:1741:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&local);- In
Insert.c:1761:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&local);- In
Insert.c:1783:
DefaultAllocator local = DefaultAllocatorInit();
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&local);- In
Insert.c:1801:
} MutElem;
typedef Vec(MutElem) MutElemVec;
// copy_init that fails on the very first call of an insert (armed via g_fail).
- In
Insert.c:1992:
int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Insert tests\n\n");
// Array of test functions
- In
Insert.c:2060:
// 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
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
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
Type.c:26:
// Define a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Type.c:38:
// Test with a struct type
typedef Vec(TestItem) TestVec;
TestVec test_vec = VecInit(&alloc);- In
Type.c:60:
// Create a valid vector
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Type.c:78:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Type tests\n\n");
// Array of test functions
- In
Type.c:86:
// Run all tests using the centralized test driver
return run_test_suite(tests, total_tests, NULL, 0, "Vec.Type");
}- In
Remove.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Remove.c:103:
}
typedef Vec(Elem) ElemVec;
// Build a deinit-tracking vec holding elements with ids 0..n-1. copy_init is
- In
Remove.c:121:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:169:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:217:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:265:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:302:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:338:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:414:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:460:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:496:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:531:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:612:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:689:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:726:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:761:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:840:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:921:
WriteFmtLn("Testing fast remove of whole vector (413:23)");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:943:
WriteFmtLn("Testing fast remove populates removed_data (418:72)");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:965:
WriteFmtLn("Testing fast remove removed_data byte count (418:74)");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:988:
reset_deinit_state();
typedef Vec(int) IntVec;
IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);- In
Remove.c:1011:
reset_deinit_state();
typedef Vec(int) IntVec;
IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);- In
Remove.c:1034:
reset_deinit_state();
typedef Vec(int) IntVec;
IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);- In
Remove.c:1056:
reset_deinit_state();
typedef Vec(int) IntVec;
IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);- In
Remove.c:1080:
reset_deinit_state();
typedef Vec(int) IntVec;
IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);- In
Remove.c:1102:
WriteFmtLn("Testing fast remove zeroes vacated tail (449:40)");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1125:
WriteFmtLn("Testing fast remove tail-zero byte count (449:70)");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1146:
WriteFmtLn("Testing fast remove tail-zero stride call (449:72)");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1253:
WriteFmt("Testing remove compaction length (first term, large start)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1276:
WriteFmt("Testing remove compaction length (second term, large count)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1299:
WriteFmt("Testing remove compaction stride (large over-move)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1320:
WriteFmt("Testing remove tail-clear destination\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
for (int i = 0; i < 10; i++) {- In
Remove.c:1339:
WriteFmt("Testing remove tail-clear length\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);
for (int i = 0; i < 10; i++) {- In
Remove.c:1358:
WriteFmt("Testing remove tail-clear stride (large over-write)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Remove.c:1399:
WriteFmt("Testing remove compaction size (length - start term)\n");
typedef Vec(u64) U64Vec;
U64Vec vec = VecInit(&alloc);- In
Remove.c:1438:
WriteFmt("Testing remove compaction size (- count term)\n");
typedef Vec(u64) U64Vec;
U64Vec vec = VecInit(&alloc);- In
Remove.c:1513:
alloc = DefaultAllocatorInit();
int rc = run_test_suite(normal_tests, normal_count, NULL, 0, "Vec.Remove");
DefaultAllocatorDeinit(&alloc);
return rc;- In
Foreach.c:2:
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Log.h>- In
Foreach.c:35:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:74:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:110:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:151:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:182:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:215:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:242:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:276:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:310:
WriteFmt("Testing VecForeach where modification causes out of bounds access (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:350:
WriteFmt("Testing VecForeachIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:388:
WriteFmt("Testing VecForeachReverseIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:427:
WriteFmt("Testing VecForeachPtrIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:465:
WriteFmt("Testing VecForeachPtrReverseIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:502:
WriteFmt("Testing VecForeachPtrInRangeIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:540:
WriteFmt("Testing basic VecForeachIdx where idx goes out of bounds (should crash)\n");
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Foreach.c:577:
int main(void) {
alloc = DefaultAllocatorInit();
WriteFmt("[INFO] Starting Vec.Foreach.Simple tests\n\n");
// Array of normal test functions
- In
Foreach.c:601:
// 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;- In
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
Access.c:35:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:70:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:110:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:144:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:178:
// Create a vector of integers
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:204:
// Same self-consistency on a higher-alignment allocator: the stride is
// still `sizeof(int)`, so VecSize and VecAlignedOffsetAt agree.
typedef Vec(int) AlignedIntVec;
AlignedIntVec aligned_vec = VecInit(&aligned8);- In
Access.c:234:
// Create a vector of integers with default alignment (1)
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:247:
// The element stride is `sizeof(T)` regardless of the allocator's base
// alignment: the allocator governs only the buffer base, never the stride.
typedef Vec(int) AlignedIntVec;
AlignedIntVec aligned_vec = VecInit(&aligned8);- In
Access.c:269:
DefaultAllocator alloc = DefaultAllocatorInit();
typedef Vec(int) IntVec;
IntVec vec = VecInit(&alloc);- In
Access.c:303:
HeapAllocator alloc = HeapAllocatorInitAligned(16);
typedef Vec(u32) U32Vec;
U32Vec vec = VecInit(&alloc);- In
Access.c:331:
DefaultAllocator alloc = DefaultAllocatorInit();
typedef Vec(u32) U32Vec;
U32Vec src = VecInit(&alloc);
u32 values[] = {10, 20, 30, 40};- In
Access.c:354:
// Main function that runs all tests
int main(void) {
WriteFmt("[INFO] Starting Vec.Access tests\n\n");
// Array of test functions
- In
Access.c:373:
// Run all tests using the centralized test driver
return run_test_suite(tests, total_tests, NULL, 0, "Vec.Access");
} Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecRunLengths Vec form\n");
BitVec bv = BitVecInit(base); Allocator *base = ALLOCATOR_OF(&alloc);
WriteFmt("Testing BitVecFindAllPattern Vec form\n");
BitVec source = BitVecInit(base);- In
Arena.c:6:
#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>- In
Arena.c:73:
static bool test_vec_on_arena(void) {
ArenaAllocator arena = ArenaAllocatorInit();
typedef Vec(int) IntVec;
IntVec v = VecInit(&arena);
bool ok = true;- In
Page.c:6:
#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>- In
Page.c:70:
// Exercises the internal descriptor table across multiple grows.
PageAllocator alloc = PageAllocatorInit();
typedef Vec(int) IntVec;
IntVec v = VecInit(&alloc);
bool ok = true;- In
Dwarf.c:7:
#include <Misra/Std/Allocator/Debug.h>
#include <Misra/Std/Allocator/Default.h>
#include <Misra/Std/Container/Vec.h>
#include <Misra/Std/Memory.h>
#include <Misra/Sys/SymbolResolver.h>- 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, { 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); } 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);- 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); 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
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)};- 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:369:
// Original data
Vec(i32) original_numbers = VecInit(&alloc);
Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);- In
RoundTrip.c:370:
// Original data
Vec(i32) original_numbers = VecInit(&alloc);
Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
// Populate arrays
- In
RoundTrip.c:397:
// Read back from JSON
Vec(i32) parsed_numbers = VecInit(&alloc);
Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);- In
RoundTrip.c:398:
// 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:674:
// 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: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:694:
// 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:695:
// 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;
Last updated on