VecPushBackL
Description
Append a single element to the end of the vector. L-value ownership form.
Success
Returns true. The vector length grows by one; val occupies the new tail. When the vector has no copy_init handler, val has been zeroed (moved-from); otherwise unchanged.
Failure
Returns false on allocation failure. Both vector and val are unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Insert.h:969:
#define VecMustPushBackL(v, val) \
do { \
if (!VecPushBackL((v), (val))) { \
LOG_FATAL("VecMustPushBackL failed"); \
} \- In
Insert.h:149:
/// TAGS: Str, PushBack, Char, LValue
///
#define StrPushBackL(str, lval) VecPushBackL((str), (lval))
///
- In
Http.c:167:
}
if (!VecPushBackL(&req->headers, hh)) {
HttpHeaderDeinit(&hh);
LOG_ERROR("failed to push header");- In
Complex.c:354:
// Add items to vectors
VecPushBackL(&vec3, item4);
VecPushBackL(&vec4, item5);- In
Complex.c:355:
// Add items to vectors
VecPushBackL(&vec3, item4);
VecPushBackL(&vec4, item5);
// Check that item 4 and 5 are no longer valid
- In
Complex.c:395:
// Test VecPushBackL
int val1 = 10;
VecPushBackL(&vec, val1);
// Test VecPushFrontL
- In
Complex.c:665:
// Test VecPushBackL zero-on-take behavior with complex structures
bool test_lvalue_zero_on_take_pushback(void) {
WriteFmt("Testing VecPushBackL zero-on-take with complex structures\n");
// Create a test item
- In
Complex.c:676:
// Insert with L-value semantics (vector takes ownership)
VecPushBackL(&temp_vec, item);
// Check that the item was zeroed
- In
Complex.c:708:
// Add the dummy item using L-value semantics
VecPushBackL(&vec, dummy);
// Now insert our test item at position 0 using L-value semantics
- In
Complex.c:747:
// Add the dummy items using L-value semantics
VecPushBackL(&vec, dummy1);
VecPushBackL(&vec, dummy2);
VecPushBackL(&vec, dummy3);- In
Complex.c:748:
// Add the dummy items using L-value semantics
VecPushBackL(&vec, dummy1);
VecPushBackL(&vec, dummy2);
VecPushBackL(&vec, dummy3);- In
Complex.c:749:
VecPushBackL(&vec, dummy1);
VecPushBackL(&vec, dummy2);
VecPushBackL(&vec, dummy3);
// Test 1: Insert at the beginning
- In
Complex.c:805:
ComplexItem dummy = {0};
dummy.name = ZstrDupAlloc("Dummy");
VecPushBackL(&vec, dummy);
// Insert with L-value semantics at the front (vector takes ownership)
- In
Complex.c:838:
// Add items to vec2
VecPushBackL(&vec2, item1);
VecPushBackL(&vec2, item2);- In
Complex.c:839:
// Add items to vec2
VecPushBackL(&vec2, item1);
VecPushBackL(&vec2, item2);
// Verify items were cleared after being added to vec2
- In
Insert.c:424:
// Test L-value insert operations
int l_value = 100;
VecPushBackL(&vec, l_value);
// Check that the element was added
- In
Insert.c:501:
// Test VecPushBackL
int val1 = 10;
VecPushBackL(&vec, val1);
bool result = (val1 == 0); // Should be zeroed
Last updated on