Add LfDArray inline dynamic array #1
Loading…
Reference in a new issue
No description provided.
Delete branch "fputs/darray"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
LfDArray, a growable buffer of trivially copyable structs.Vectorstays avoid *array.initallocates two elements. Growth doubles throughlf_reallocarray. A failed grow leaves length, capacity, the pointer, and the existing bytes unchanged. There is no per-element destructor.sortis ISOqsortover the element bytes, so the comparator sees the struct, not avoid **.Allocation failure is covered in
test_alloc_fail: after two pushes, the nextreallocinsidepushfails and the array is unchanged.Tested with
-DCMAKE_BUILD_TYPE=Debug -DFLINT_SANITIZE=ON -DCMAKE_C_EXTENSIONS=OFF.ctest --label-exclude slow: 26/26 passed.fc416490e1708e6412ba708e6412baf781872509